本文整理汇总了C#中IManyToOneInstance类的典型用法代码示例。如果您正苦于以下问题:C# IManyToOneInstance类的具体用法?C# IManyToOneInstance怎么用?C# IManyToOneInstance使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IManyToOneInstance类属于命名空间,在下文中一共展示了IManyToOneInstance类的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)
{
if (instance.Property.MemberInfo.IsDefined(typeof(RequiredAttribute), false))
instance.Not.Nullable();
else
instance.Nullable();
}
示例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)
{
var type = instance.EntityType;
var member = instance.Property;
var columnName = GetConstraintName(type.Name, member.Name);
instance.ForeignKey(columnName);
}
示例5: Apply
public void Apply(IManyToOneInstance instance)
{
if (!IsNotNull(instance))
return;
instance.Not.Nullable();
instance.NotFound.Exception();
}
示例6: 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));
}
示例7: 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));
}
示例8: 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"));
}
示例9: 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();
}
示例10: 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));
}
示例11: 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");
}
示例12: Apply
public void Apply(IManyToOneInstance instance)
{
var meta = QueryFluentMetadata.FindMetadataFor(instance.EntityType, instance.Property.Name);
if (meta != null && meta.Required.HasValue && meta.Required.Value)
{
instance.Not.Nullable();
}
}
示例13: Apply
public void Apply(IManyToOneInstance instance)
{
var abbreviation = AttributeHelper.GetTypeAttribute<AbbreviationAttribute>(instance.Property.PropertyType);
var prefix = abbreviation == null
? instance.Property.PropertyType.Name
: abbreviation.Abbreviation;
instance.Column((prefix + "Id").EscapeColumnName());
}
示例14: Apply
/// <summary>
/// Applies this reference convention to the specified <see cref = "IManyToOneInstance" />.
/// </summary>
/// <param name="instance">An <see cref = "IManyToOneInstance" />.</param>
public void Apply(IManyToOneInstance instance)
{
if (instance == null)
{
throw new ArgumentNullException("instance");
}
instance.Column(instance.Property.Name + "Id");
}
示例15: 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 );
}