c# - ASP.NET MVC 3 with already built SQL Server on different databases -
i'm creating asp.net mvc3 project in c# using existing sql server database.
the sql server has different databases, 1 each customer. each customer database has numerous tables, i'm interested in 1 table.
so, i'm interested in retrieving (and not updating or deleting) data same table of every customer. database configuration example:
databasecustomername1
- tableneeded
databasecustomername2
- tableneeded
databasecustomernamen
- tableneeded
the question is... how create model?
knowing if had 1 customer create model basing on fields of tables, how can manage situation of having multiple customers?
thanks in advance.
attila
you should have interface repository class example , different implementations each custumer data base
internal interface iproductrepository { ienumerable<product> getall(); } class productrepositorycustumerone : iproductrepository { public ienumerable<product> getall() { //code retrieve data } } class productrepositorycustumertwo : iproductrepository { public ienumerable<product> getall() { //code retrieve data } }
after can inject ioc container implementation need
Comments
Post a Comment