Missing something with Entity Framework for .NET 3.5?

Is it possible for EF to create the necessary objects when I have two related tables related to FK in .NET3.5SP1? I see where the checkbox to support this is disabled, but it is available in .NET4.

I have a database in which there are only tables with relationships. I need to create a Silverlight application (SL4) that allows you to manage data in this application. I can’t use .NET4 on the server ... only .NET3.5SP1, so the FK relationship bit in EF4 is not available to me. Trying to avoid building as many plumbing as possible in order to return to the database from the SL4 application as much as possible ...

+4
source share
1 answer

Are you using Visual Studio 2010 and the target .NET Framework 3.5 in your project settings?

If this is the case, I think with the “checkbox disabled” you mean the checkbox for including foreign key columns in the wizard to create an Entity model from the database. (This flag does not exist at all in VS2008 and is not disabled when targeting .NET 4.0 in VS2010. Therefore, my theory is about VS2010 with .NET 3.5.)

So there is relatively good news for you: this checkbox does NOT mean that no Entity relationships will be created from tables linked by foreign key constraints. They will be created, also in Entity Framework 1 (.NET 3.5). You will not only have the scalar Entity properties that your foreign key columns represent. (This check box, available only in .NET 4, will be marked with these properties in the model.) Instead, you always have to deal with objects referenced in your entities (check if they are loaded, load them manually, or enable them directly in requests, etc.).

Thus, you have a little less comfort when working with relationships in the Entity model in .NET 3.5, but foreign key constraints are still displayed correctly and are automatically created. Just let the wizard run and explore the created Entity model.

+3
source

Source: https://habr.com/ru/post/1312892/


All Articles