dimanche 18 mai 2014

c# - construction entité XML lors de l'exécution - Stack Overflow


I am using a custom data access framework (based on repository pattern) to access data from SQL Server. In this case I define the select statement result as Entity in the Data Access layer configuration file, which is result of an operation (also defined in the same configuration file). These details are mapped to couple of other configuration files in the Business Layer and Service Layer. Now to access the data I have to create strongly typed entity class in C#, which maps the column names in the entity in the DAL. It works fine, I can create strongly typed collection for data binding. In case I need to make a change in my entity in the DAL, then along with config files, I need to make changes to the C# code and recompile. However, I am keen to avoid that, just want changes in config file to be picked up, for which entity should be created at run time, based on config file and it should be able to accommodate the changes, what should be the best way to achieve it?



  • Shall I use reflection to create types at run time

  • Will dynamic types help?

  • Does entity framework support such dynamic creation?


Any pointer to get me started in the right direction, I have a concern that run time creation of types may impact the performance



I am using a custom data access framework (based on repository pattern) to access data from SQL Server. In this case I define the select statement result as Entity in the Data Access layer configuration file, which is result of an operation (also defined in the same configuration file). These details are mapped to couple of other configuration files in the Business Layer and Service Layer. Now to access the data I have to create strongly typed entity class in C#, which maps the column names in the entity in the DAL. It works fine, I can create strongly typed collection for data binding. In case I need to make a change in my entity in the DAL, then along with config files, I need to make changes to the C# code and recompile. However, I am keen to avoid that, just want changes in config file to be picked up, for which entity should be created at run time, based on config file and it should be able to accommodate the changes, what should be the best way to achieve it?



  • Shall I use reflection to create types at run time

  • Will dynamic types help?

  • Does entity framework support such dynamic creation?


Any pointer to get me started in the right direction, I have a concern that run time creation of types may impact the performance


0 commentaires:

Enregistrer un commentaire