是否有任何人知道如何在EF4(实体框架4)中改变一个实体的列表?
后来的编辑: 我认为,在模型浏览器中找到了表格名称定义的地方。 但是,他们的名字只读了,因此不可能用设计师来编辑。 此外,在Xml schema的表格名称上没有提及(从一盘查询)。
是否有任何人知道如何在EF4(实体框架4)中改变一个实体的列表?
后来的编辑: 我认为,在模型浏览器中找到了表格名称定义的地方。 但是,他们的名字只读了,因此不可能用设计师来编辑。 此外,在Xml schema的表格名称上没有提及(从一盘查询)。
如果你真的需要更改表格的名称,你可以:
<EntitySet Name="Customers" EntityType="ExampleModel.Store.Customers" Schema="dbo" />
. Table="MyTableName"
attribute. <EntitySet Name="Customers" EntityType="ExampleModel.Store.Customers" Schema="dbo" Table="MyTableName" />
http://msdn.microsoft.com/en-us/library/bb399604.aspx” rel=“noreferer”CSDL、SSDL、MSL规格。
希望会有所帮助。
另一种解决办法是,在您的<代码>DbContext类别中推翻一种方法。
public class MyDbContext : DbContext
{
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Entity<Product>().ToTable("DB_PRODUCTS_TBL");
// otherwise EF assumes the table is called "Products"
}
}
我认为,你要求的是把一个实体的地图重新编成表格。 你可以点击一个实体,选择表图。 这将向贵实体显示表格的绘制。 你可以改变那里的情况。 然而,当你开始下降时,你只能看到你利用《更新模式》进口的表格。 如果该表没有进口,将不予列入。 然后,你可以把这些财产适当绘制到表格的栏目。
在模型Browser,或设计表面右翼,实体和选定特性。 在财产窗口中,“固定名称”为外地。
这对我来说是行之有效的,但我正在首先设计该表,然后创建数据库。
由于我首先建立了我的数据库,我做了以下工作:
Note: Whether all these steps above are needed I don t know, it s just what I tried and it worked for me.
你可以执行一个储存的假体,改变表名称,将表格名称作为变量。 然后将所储存的矿石进口到EF4。
CREATE PROCEDURE ChangeTableName
@TableName varchar(200)
AS
BEGIN
SET NOCOUNT ON;
EXEC sp_rename "User", @TableName
END
GO
What is the use of default keyword in C#? Is it introduced in C# 3.0 ?
I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...
I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...
I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...
I have two EF entities. One has a property called HouseNumber. The other has two properties, one called StartHouseNumber and one called EndHouseNumber. I want to create a many to many association ...
How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...
Since I cannot order my dictionary, what is the best way of going about taking key value pairs and also maintaing an index?
Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...