linq to sql - Entity Framework Code First Configure Schema Per Entity -


in linq sql there simple convention tell mapper database schema use - [table(name = "schemaname.tablename")].

is there similar in ef cf 4.1? rather not use annotations in entity classes keep them pure possible. sake of keeping project moving i'll make sacrifice though.

this question close, not need. may outdated looks it's referring classes have been renamed or have had breaking changes since recent ef 4.1 release - entity framework 4: code first - creating db in schema? mapsingletype?

edit: should mention application has 3 schemas @ moment, can't use solution changes default schema "dbo" "otherschema".

the linked answer old , doesn't work because custom conventions removed final version. if want change name of schema can use fluent api:

public class context : dbcontext {     public dbset<yourtype> yourtypeset { get; set; }      protected override void onmodelcreating(dbmodelbuilder modelbuilder)     {         base.onmodelcreating(modelbuilder);         modelbuilder.entity<yourtype>().totable("tablename", "schemaname");     } } 

Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -