asp.net mvc 2 with dynamically generated views -


i trying build asp.net mvc 2 app data entry. want generate views on forms dynamically using htmlhelpers . flexible option datasource ? when change database dont have change code @ all(so guess ef not option)? no model/controller changes etc. or don't have choice changing models in code?

well change database, assume mean change dbms, sql server oracle example.

i doubt you'll find solution without code changes @ all, can make things lot simpler using interfaces services.

for example

public interface idatarepository {       ... } public class sqlserverdatarepository : idatarepository {       ... } 

and testing

public class mockrepository : idatarepository {        ... } 

and later if swith databases

public class oraclerepository : idatarepository {        ... } 

this used simple referring interfaces

public class myservice {        public myservice(irepository repo)        {              //ctor        { } 

and ideally injecting objects inversion of control, ninject or structuremap example.

apologies if know , looking different!


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -