Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6047313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:20:15+00:00 2026-05-23T07:20:15+00:00

So an application I work on currently uses Linq2SQL and maps classes 1-1 to

  • 0

So an application I work on currently uses Linq2SQL and maps classes 1-1 to the database schema. This is generally realistic but inconvenient for a certain area of the DB. I am experimenting with EntityFramework 4.1 and seeing if I can get a more natural strongly-typed mapping for this given area.


The area looks like somewhat like this (each table has a Guid-uniqueidentifier for the ID of each row):

tblSubscription [has one Service, has many SubscriptionParameters]
– fkService (Guid)

tblService [has many Subscriptions, has many ServiceParameters]
– sServiceType (String)

tblSubscriptionParameter [has one Subscription, has one ServiceParameter]
– sValue (String – often the string representation of an int or a bool)
– nIndex (Int – for multiple values corresponding to the same service parameter)
– fkServiceParameter (Guid)

tblServiceParameter [has one Service, has many SubscriptionParameters]
– sName (String)
– fkService (Guid)


The fundamental table here is Subscriptions. There are some different specialized types of subscriptions that I would like to hard code. The advantage this would give me is that I might be able to write something resembling:

var allTestParams = ...SecretSubscriptions.Select(s => s.TestParameter)

instead of the rather ugly pattern I must follow using Linq2SQL:

var allTestParams = ...Subscriptions.Where(s => s.Service.Name == "SecretService")
    .Select(s => s.SubscriptionParameters.First(sp => 
        sp.ServiceParameter.Name == "TestParameter").Value);

So I would like to have specialized subscription classes that inherit from some base subscription class that explicitly type out which Service type they belong to, and have properties that can get and set to specified SubscriptionParameters. At the same time I want to use a generic subscription class with simple access to a collection of Parameters for certain applications (e.g. auditing) which will interact with parameters without really caring about what they represent.

How can I configure EntityFramework so I can code more fluidly with stronger type enforcements?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T07:20:15+00:00Added an answer on May 23, 2026 at 7:20 am

    EF will not help you with this. It can help you with mapping general subscriptions to specialized types via table per hierarchy inheritance (but Linq-to-sql can do it as well) but it will not allow you mapping related entities as parameters of the derived subscription type. It would require custom database views and stored procedures for modifications.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have an application which uses EF database first which was built against
Currently our application uses GWT-RPC for most client-server communication. Where this breaks down is
My application has a model which currently uses an integer in the SQL database
I'm currently working on an internal sales application for the company I work for,
I'm currently working on a web application development. Our company methodology is to work
I'm trying to get a CakePHP application to work. For this, I've set up
I'm developing a multi-document application. Currently it uses MDI which is quite convenient for
I'm currently working on an android application that uses a subclass of SimpleListAdapter to
The company I work for currently uses Go To Meeting to share our desktops
My Python application currently uses the python-memcached API to set and get objects in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.