We are developing an application against a SQL Server 2005 database that uses several schemas for security purposes. The application will be using EF 2 in the .NET 4.0 framework.
What I'm wondering is how those SQL Schemas (Support, Admin, Employee) etc. can/will/should be represented on the EF side. Should I separate the various entities into separate models (edmx files) in the application to reflect the SQL schemas? I'm not as concerned about name conflicts as much as understanding the model more intuitively.
What are the recommendations or best practices in this area?
Thanks!
Inheritance in the Entity Framework is similar to inheritance for classes in C#. In Entity Framework, you can map an inheritance hierarchy to single or multiple database tables based on your requirements. In this article, you will learn how to map your inheritance hierarchy to database tables in SQL Server.
The Entity Framework uses information in the model and mapping files to translate object queries against entity types represented in the conceptual model into data source-specific queries. Query results are materialized into objects that the Entity Framework manages.
you could decorate your class with TableAttribute if you are using attribute based mapping.
Generally speaking table in one schema is a different entity than table in another schema, so reflecting that you could group your classes in respective namespaces.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With