从后面的代码自动更新LINQ MODEL。 [英] Automatic Updated Of LINQ MODEL from code behind.
本文介绍了从后面的代码自动更新LINQ MODEL。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法从后面的代码更新Linq模型???
CompanyMaster。 aspx
有company_code和company_name字段。
创建公司时,数据库会自动为不同公司添加多个默认表,不同公司的模式不同。
例如:
代表001,company_1
001.table_1
002.table_2
等。
代表002,company_2
002.table_1
002.table_2
等
这可以使用简单的查询执行来完成,但有没有办法使用Linq?
使用LINQ向表添加模式不是问题,但主要问题是如何从代码后面自动更新LINQ模型?
推荐答案
感谢您的澄清。
* .edmx [ ^ ]文件是一个存储器:1)概念模式,2)存储模型和3)这些模型之间的映射模型楷模。换句话说,所有这些共同定义实体数据模型 [ ^ 。
我建议读这个:创建数据访问层 [ ^ ]。这是一个教程,描述了如何使用ASP.NET Web Forms和Entity Framework Code First从数据库创建,访问和查看数据。为什么代码优先?因为它可以创建具有多个数据上下文的迁移。
有关详细信息,请参阅:
实体框架6代码优先迁移多个数据上下文 [ ^ ]
多个DbContext中的代码优先迁移 [ ^ ]
数据点:实体框架6中的代码优先价值 [ ^ ]
实体框架(EF)文档 [ ^ ]
维基百科:实体框架 [ ^ ]
祝您好运!
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!
如果您正在寻找创建模型,即只有数据库表列的元数据,您可以使用Entity Developer等工具br />
将根据你提供的表名创建一个temp.cs类
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
这篇关于从后面的代码自动更新LINQ MODEL。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文