Click here to Skip to main content
15,889,335 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:

is there any way of updating Linq model from code behind???

CompanyMaster.aspx
has company_code and company_name field.
when a company is created then database automatically add Multiple default table for different company with different schema for different company.
e.g:
for 001,company_1
001.table_1
002.table_2
etc .
for 002,company_2
002.table_1
002.table_2
etc.

this can be done using simple query execution, but is there any way to do in using Linq??
adding schema to a table using LINQ is not the problem, but the main problem is that how to update the LINQ Model automatically from code behind??
Posted
Comments
Maciej Los 10-Dec-14 17:23pm    
Sorry, bt i don't get you... Please, provide more details. What is your model? Have you created a Data Access Layer?
/\jmot 10-Dec-14 22:44pm    
Model means the Linq to Sql .edmx file, where all the db table maps.
Maciej Los 11-Dec-14 2:42am    
Thank you for clarification. Please, see my answer.

Thank you for clarification.

*.edmx[^] file is a storage for: 1) a conceptual mode, 2) storage model and 3) mapping model between these models. In other words, all these things together define Entity Data Model[^].

I'd suggest to read this: Create the Data Access Layer[^]. It's a tutorial, which describes how to create, access, and review data from a database using ASP.NET Web Forms and Entity Framework Code First. Why Code First? Because it enables to create migrations with multiple data context.

For further information, please see:
Entity Framework 6 Code First Migrations with Multiple Data Contexts[^]
Code First Migration in Multiple DbContext[^]
Data Points: Code First Goodies in Entity Framework 6[^]
Entity Framework (EF) Documentation[^]
Wikipedia: Entity Framework[^]

Good luck!
 
Share this answer
 
If you are looking for creating a model i.e nothing but the metadata of your database table columns you can use tools such as Entity Developer

which will create a "temp.cs" class based on you table name provided
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900