Siva Senthil
Siva Senthil

Reputation: 610

Differences between TableAttribute class in System.Data.Linq.Mapping and System.ComponentModel.DataAnnotations.Schema

I am using EF 6.1 where I was trying to get a simple sample code running.
I accidentally used the namespace System.Data.Linq.Mapping (VS Intellisense) to realize the TableAttribute name parameter had no effect, the code created a new table (since POCO class name is different from table Name) when was executed. However, it was expected to use and existing table. Latter after few googling effort I noticed the namespace System.ComponentModel.DataAnnotation is used in some places. When I made this change, my sample started using the existing table rather than creating it. I would like to know

Upvotes: 2

Views: 1276

Answers (1)

D.R.
D.R.

Reputation: 21224

  • System.Data.Linq.Mapping.TableAttribute belongs to LINQ to Entities.
  • Entity Framework uses the System.ComponentModel.DataAnnotation.TableAttribute

Upvotes: 4

Related Questions