1

I have a set of SQL server views working as abstraction layer for an underlying table structure. The views are simple abstractions of the underlying tables (renaming of columns and tables) and it is in general possible to edit data using them.

Regardless if I import them in a LINQ to SQL data context or into the ADO.NET Entity Framework, the import process ignores details such as primary keys, identities or required fields of the underlying tables and generates the wrong code for data manipulations. I can repair this by editing the related properties in the designer, but a data structure update later and my changes are gone. I’m searching for a more maintainable method of doing this. Something like adding the missing key and type information to the views, giving LINQ the information to generate the appropriate code. Any recommendations?

2
  • Do you do more than just rename the columns and tables? you can do these things using the objects generated in the designer. Commented Dec 13, 2010 at 14:39
  • I know, but this question is about importing views without editing anything in the designer. Commented Dec 13, 2010 at 14:50

2 Answers 2

1

Ah - not use EntityFramework import tools? Thsoe are IMHO anyway pretty unusable for larger projects (more than 30-50 tables) as it really gets out of hands with its import times etc.

Maintain your mappings in code.

Sign up to request clarification or add additional context in comments.

Comments

0

Have you looked at the ADO.NET Entity Framework ?

1 Comment

I looked at both: LINQ to SQL and LINQ to entities. The missing details are different, but for example neither of them correctly imports the primary keys.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.