本文整理汇总了C#中IManyToOneInstance.ForeignKey方法的典型用法代码示例。如果您正苦于以下问题:C# IManyToOneInstance.ForeignKey方法的具体用法?C# IManyToOneInstance.ForeignKey怎么用?C# IManyToOneInstance.ForeignKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IManyToOneInstance
的用法示例。
在下文中一共展示了IManyToOneInstance.ForeignKey方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Apply
public void Apply(IManyToOneInstance instance)
{
string entity = instance.EntityType.Name;
string member = instance.Property.Name;
instance.ForeignKey($"FK_{entity}_{member}");
}
示例2: Apply
public void Apply(IManyToOneInstance instance)
{
var type = instance.EntityType;
var member = instance.Property;
var columnName = GetConstraintName(type.Name, member.Name);
instance.ForeignKey(columnName);
}
示例3: Apply
public void Apply(IManyToOneInstance instance)
{
instance.ForeignKey(string.Format("FK_{0}_{1}",
instance.Name, instance.EntityType.Name));
}
示例4: Apply
public void Apply(IManyToOneInstance instance)
{
if (Attribute.IsDefined(instance.Property.MemberInfo, typeof(RequiredAttribute)))
instance.Not.Nullable();
instance.ForeignKey(string.Format("FK_{0}_{1}_{2}", instance.EntityType.Name, instance.Class.Name, instance.Property.Name));
}
示例5: Apply
public void Apply(IManyToOneInstance instance)
{
string entity = instance.EntityType.Name;
string member = instance.Property.Name;
instance.ForeignKey(string.Format("FK_{0}_{1}", entity, member));
}
示例6: Apply
public void Apply(IManyToOneInstance instance)
{
if (!instance.Property.PropertyType.IsInterface)
{
instance.Column(instance.Property.PropertyType.Name + "Id");
}
instance.ForeignKey(instance.EntityType.Name + "_" + instance.Property.Name + "_FK");
}
示例7: Apply
public void Apply(IManyToOneInstance instance)
{
instance.Column(instance.Property.Name + "ID");
instance.ForeignKey(string.Format("FK_{0}_{1}_{2}",
instance.EntityType.Name + "s",
instance.Property.Name + "s",
instance.Property.Name + "ID"));
}
示例8: Apply
public void Apply(IManyToOneInstance instance)
{
var foreignKeyName = string.Format("FK__{0}_{1}__{2}", instance.EntityType.Name, instance.Name, instance.Class.Name);
instance.ForeignKey(foreignKeyName);
instance.Column(instance.Name + "Id");
instance.Not.Nullable();
}
示例9: Apply
public void Apply(IManyToOneInstance instance)
{
instance.Column(instance.Property.Name + ConventionConstants.Id);
instance.ForeignKey(string.Format("FK_{0}_{1}_{2}",
instance.EntityType.Name + ConventionConstants.TableSuffix,
instance.Property.Name + ConventionConstants.TableSuffix,
instance.Property.Name + ConventionConstants.Id));
}
示例10: Apply
/// <summary>
/// Applies Foriegn key based on type.
/// </summary>
/// <param name="instance">The instance.</param>
public void Apply( IManyToOneInstance instance )
{
var referenceName = instance.GetReferenceName ().Replace ( "`1", string.Empty );
// Name the foreign key constraint
var foreignKeyName = string.Format ( "{0}_FK", referenceName );
instance.ForeignKey ( foreignKeyName );
}
示例11: Apply
public void Apply(IManyToOneInstance instance)
{
instance.Cascade.All();
instance.Not.Nullable();
instance.Column(NamingHelper.GetPrefixedName(instance.Property.PropertyType) + "_id");
instance.ForeignKey(string.Format("fk_{0}_{1}",
Inflector.Underscore(instance.Property.PropertyType.Name),
NamingHelper.GetPrefixedName(instance.EntityType)));
}
示例12: Apply
public void Apply(IManyToOneInstance instance)
{
instance.Cascade.SaveUpdate();
instance.NotFound.Ignore();
instance.ForeignKey(string.Format("FK_{0}_{1}",
(instance.EntityType != null) ? instance.EntityType.Name : instance.Name, instance.Property.Name));
var index = string.Format("IX_{0}_{1}", instance.EntityType.Name, instance.Property.Name);
if (Indices.Contains(index)) return;
instance.Index(index);
Indices.Add(index);
}
示例13: Apply
public void Apply(IManyToOneInstance instance)
{
instance.ForeignKey($"FK_{instance.EntityType.Name.Pluralize()}_Ref_{instance.Name.Pluralize()}");
}
示例14: Apply
public void Apply(IManyToOneInstance instance)
{
instance.ForeignKey(getForeignKeyName(instance.Property.DeclaringType, instance.Property.PropertyType));
}
示例15: Apply
public void Apply(IManyToOneInstance instance)
{
instance.ForeignKey(string.Format("{0}Id", instance.Class.Name));
}