Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/337.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 代码优先索引&;SQL Server中的密钥名_C#_.net_Linq_Entity Framework 6 - Fatal编程技术网

C# 代码优先索引&;SQL Server中的密钥名

C# 代码优先索引&;SQL Server中的密钥名,c#,.net,linq,entity-framework-6,C#,.net,Linq,Entity Framework 6,我使用代码优先的方法,当我更新数据库时,它会在我想要控制的sql数据库上创建键/索引名。它创建键名PK\u dbo.Properties、外键FK\u dbo.Properties\u dbo.Documents\u PropertyId和索引名PK\u dbo.Properties。如何控制键和索引名的名称 我怎样才能改名字 我已经添加了数据库的图像和 我的代码 public class Property { public int PropertyId { get; set; } [Requ

我使用代码优先的方法,当我更新数据库时,它会在我想要控制的sql数据库上创建键/索引名。它创建键名PK\u dbo.Properties、外键FK\u dbo.Properties\u dbo.Documents\u PropertyId和索引名PK\u dbo.Properties。如何控制键和索引名的名称

我怎样才能改名字

我已经添加了数据库的图像和

我的代码

public class Property
{
public int PropertyId { get; set; }

[Required]
[Column(TypeName = "VarChar")]
[StringLength(50)]
public string Title { get; set; }

public decimal Price { get; set; }

public string Description { get; set; }

public string Bedrooms { get; set; }

public string Bathrooms { get; set; }

public int Accommodate { get; set; }

public string Area { get; set; }

public int Type { get; set; }

public string Latitude { get; set; }

public string Longitude { get; set; }

[ForeignKey("PropertyId")]
public List<Amenity> Amenities { get; set; }

[ForeignKey("PropertyId")]
public List<Image> Images { get; set; }

public virtual Document Document { get; set; }
}
公共类属性
{
公共int属性ID{get;set;}
[必需]
[列(TypeName=“VarChar”)]
[长度(50)]
公共字符串标题{get;set;}
公共十进制价格{get;set;}
公共字符串说明{get;set;}
公共字符串卧室{get;set;}
公共字符串浴室{get;set;}
公共整数{get;set;}
公共字符串区域{get;set;}
公共int类型{get;set;}
公共字符串纬度{get;set;}
公共字符串经度{get;set;}
[外键(“属性ID”)]
公共列表{get;set;}
[外键(“属性ID”)]
公共列表图像{get;set;}
公共虚拟文档文档{get;set;}
}