public void Apply(IManyToOneInstance instance) { string entity = instance.EntityType.Name; string member = instance.Property.Name; instance.ForeignKey(string.Format("FK_{0}_{1}", entity, member)); }
public void Apply(IManyToOneInstance instance) { if (!IsNotNull(instance)) return; instance.Not.Nullable(); instance.NotFound.Exception(); }
public void Apply(IManyToOneInstance instance) { var type = instance.EntityType; var member = instance.Property; var columnName = GetConstraintName(type.Name, member.Name); instance.ForeignKey(columnName); }
public void Apply(IManyToOneInstance instance) { string entity = instance.EntityType.Name; string member = instance.Property.Name; instance.ForeignKey($"FK_{entity}_{member}"); }
public void Apply(IManyToOneInstance instance) { instance.ForeignKey(string.Format("FK_{0}_{1}", instance.Name, instance.EntityType.Name)); }
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)); }
public void Apply(IManyToOneInstance instance) { if (instance.Property.MemberInfo.IsDefined(typeof(RequiredAttribute), false)) instance.Not.Nullable(); else instance.Nullable(); }
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(); } }
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"); }
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)); }
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(); }
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")); }
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()); }
/// <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 ); }
/// <summary> /// The convention that is applied to a <see cref = "IPropertyInstance" /> when the criteria from the Accept method is meet. /// </summary> /// <param name="instance">An <see cref = "IPropertyInstance" /> to apply the convention to.</param> public void Apply(IManyToOneInstance instance) { if (instance == null) { throw new ArgumentNullException("instance"); } instance.Not.Nullable(); }
/// <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"); }
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))); }
/// <summary> /// Apply changes to the target /// </summary> public void Apply(IManyToOneInstance instance) { Type inferredType = instance.Class.GetUnderlyingSystemType(); Type persistentType = _mapProxyInterfaceTypeToPersistentType(inferredType); if (persistentType != null) { instance.OverrideInferredClass(persistentType); } }
public void Apply(IManyToOneInstance instance) { var attr = instance.Property.PropertyType.GetCustomAttribute<TableNameAttribute>(); if (instance.Property.MemberInfo.IsDefined(typeof (NotNullAttribute), false)) instance.Not.Nullable(); var columnName = string.Format("{0}Id", (attr != null ? attr.TableName : instance.Property.PropertyType.Name)); instance.Column(columnName); }
/// <summary> /// Applies Foriegn key column name based on type. /// </summary> /// <param name="instance">The instance.</param> public void Apply( IManyToOneInstance instance ) { // name the key field var key = instance.Property.Name; if ( typeof( ILookup ).IsAssignableFrom ( instance.Property.PropertyType ) ) { key = key + "Lkp"; } instance.Column ( key + "Key" ); }
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); }
/// <summary> /// Applies nullablity based on type. /// </summary> /// <param name="instance">The instance.</param> public void Apply( IManyToOneInstance instance ) { var member = instance.Property; var entityType = instance.EntityType; if (!entityType.IsNHibernateComponent()) { if ( !member.IsDbNullable () ) { instance.Not.Nullable (); } } }
public void Apply(IManyToOneInstance instance) { string colName = null; var referenceType = instance.Class.GetUnderlyingSystemType(); var entityType = instance.EntityType; var propertyName = instance.Property.Name; //Self association if (referenceType == entityType) colName = "ParentId"; else colName = propertyName + "Id"; instance.Column(colName); }
/// <summary> /// Applies access based on type. /// </summary> /// <param name="instance">The instance.</param> public void Apply( IManyToOneInstance instance ) { var entityType = instance.EntityType; var propertyName = instance.Name; var propertyInfo = entityType.GetProperty ( propertyName, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance ); if ( propertyInfo.IsAutoProperty () ) { instance.Access.BackField (); } else { instance.Access.CamelCaseField ( CamelCasePrefix.Underscore ); } }
public void Apply(IManyToOneInstance instance) { string colName = string.Empty; var referenceType = instance.Class.GetUnderlyingSystemType(); var entityType = instance.EntityType; var propertyName = instance.Property.Name; if (referenceType == entityType) // self association { colName = "PARENT_ID"; } else { colName = propertyName.ToDatabaseName().ToUpper(); } instance.Column(colName); }
public void Apply(IManyToOneInstance instance) { string colName = null; Type referenceType = instance.Class.GetUnderlyingSystemType(); Type entityType = instance.EntityType; string propertyName = instance.Property.Name; //instance.LazyLoad(Laziness.NoProxy); //Self association if (referenceType == entityType) colName = "PARENT_ID"; else colName = propertyName.ToDatabaseName() + "_ID"; instance.Column(colName); instance.Cascade.None(); Debug.WriteLine("----ReferenceConvention----" + colName + instance.EntityType + " referenceType:" + referenceType); }
/// <summary> /// Sets cascade mode to AllDeleteOrphan for all types except Aggregate roots and instances with <see cref="NoneCascadingAttribute"/>. /// Aggregate roots cascade mode is None. /// </summary> /// <param name="instance">The instance.</param> public void Apply( IManyToOneInstance instance ) { var rootSubClass = typeof( AbstractAggregateRoot ).IsAssignableFrom ( instance.Property.PropertyType ); if ( rootSubClass ) { instance.Cascade.None (); } else { var noneCascadingAttributeAttributes = instance.Property.MemberInfo.GetCustomAttributes ( typeof( NoneCascadingAttribute ), false ); if ( noneCascadingAttributeAttributes.Length == 1 ) { instance.Cascade.None (); } else { instance.Cascade.SaveUpdate (); } } }
public void Apply(IManyToOneInstance instance) { instance.Access.ReadOnlyPropertyThroughCamelCaseField(CamelCasePrefix.Underscore); }
public void Apply(IManyToOneInstance instance) { var fkName = $"FK_{instance.EntityType.Name}To{instance.Class.Name}_{instance.Name}"; instance.ForeignKey(fkName); }
public void Apply(IManyToOneInstance instance) { DefaultCascade.All(); }
public void Apply(IManyToOneInstance instance) { instance.Fetch.Join(); }
public void Apply(IManyToOneInstance instance) { instance.Cascade.SaveUpdate(); }
public void Apply(IManyToOneInstance instance) { instance.ForeignKey(getForeignKeyName(instance.Property.DeclaringType, instance.Property.PropertyType)); }
public void Apply(IManyToOneInstance instance) { instance.Column(EscapeColumn(instance.Name)); }
public void Apply(IManyToOneInstance instance) { instance.LazyLoad(Laziness.Proxy); instance.Cascade.None(); instance.Not.Nullable(); }
public void Apply(IManyToOneInstance instance) { var columnName = GetKeyName(instance.Property, instance.Class.GetUnderlyingSystemType()); instance.Column(columnName); }
//TODO:KOA: надо будет настроить LazyLoad public void Apply(IManyToOneInstance instance) { instance.Not.LazyLoad(); instance.Cascade.All(); }
public void Apply(IManyToOneInstance instance) { }
public void Apply(IManyToOneInstance instance) { instance.Column($"{instance.Name}_id".Underscore()); }
public void Apply(IManyToOneInstance instance) { var fkName = GetFkName($"FK_{instance.EntityType.Name}_{instance.Name}"); instance.ForeignKey(fkName); }
public void Apply(IManyToOneInstance instance) { instance.Column(instance.Property.Name + "Id"); }
public virtual void Apply(IManyToOneInstance instance) { Apply(instance.EntityType, instance.Name, instance.Access); }
public void Apply(IManyToOneInstance instance) { instance.Column("test"); }
public bool Accept(IManyToOneInstance instance) { return(true); }
public void Apply(IManyToOneInstance instance) { instance.Not.Nullable(); }
public void Apply(IManyToOneInstance instance) { instance.Formula(FormulaValue); }
public void Apply(IManyToOneInstance instance) { instance.Column(string.Format("[{0}]", instance.Name)); }
public void Apply(IManyToOneInstance instance) { instance.Access.Field(); }
public void Apply(IManyToOneInstance instance) { instance.Column(instance.Class.Name + "FK"); }
public void Apply(IManyToOneInstance instance) { instance.Column(string.Format(instance.Class.Name.StartsWith("Id") ? "{1}" : "{0}{1}", "Id", instance.Class.Name)); instance.LazyLoad(); }
public void Apply(IManyToOneInstance instance) { instance.ForeignKey(GetForeignKeyName(instance.EntityType.Name, instance.Property.Name)); }
/// <summary> /// Apply changes to the target /// </summary> public void Apply(IManyToOneInstance instance) { instance.Column(GetAbbrName(instance.Property.Name).ToOracleNaming() + Delimiter + Options.ForeignKeySurfix); }
public void Apply(IManyToOneInstance instance) { instance.Not.LazyLoad(); }
public void Apply(IManyToOneInstance instance) { var key = String.Format("{0}_{1}_FK", instance.EntityType.Name, instance.Property.PropertyType.Name); instance.ForeignKey(key); }
/// <summary> /// many-to-one 관계에 대한 Convention을 적용합니다. /// </summary> public void Apply(IManyToOneInstance instance) { instance.Column(GetAbbrName(instance.Property.Name) + Options.ForeignKeySurfix); }
public void Apply(IManyToOneInstance instance) { instance.Cascade.All(); }
/// <summary> /// Applies the specified instance. /// </summary> /// <param name="instance">The instance.</param> public void Apply(IManyToOneInstance instance) { instance.Column(instance.Name + "Id"); }
public void Apply(IManyToOneInstance instance) { instance.LazyLoad(Laziness.NoProxy); }
public void Apply(IManyToOneInstance instance) { instance.Fetch.Join(); }
public void Apply(IManyToOneInstance instance) { instance.Column(instance.Property.PropertyType.Name + "ID"); //replace with _id when DB is cleaned up }