Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does the Entity Framework handle SQL Server Schemas?

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!

like image 898
monkeymindllc Avatar asked Jul 13 '10 15:07

monkeymindllc


People also ask

How does Entity Framework handle inheritance?

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.

How does the Entity Framework work?

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.


1 Answers

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.

like image 135
np-hard Avatar answered Sep 30 '22 14:09

np-hard