Пример #1
0
 public void Apply(IOneToManyCollectionInstance instance)
 {
     instance.Key.Column(string.Format(CultureInfo.InvariantCulture, "{0}_id",
                                       NameConverter.ConvertName(instance.EntityType.Name)));
     instance.Key.ForeignKey(string.Format(CultureInfo.InvariantCulture, "fk_{0}_{1}",
                                           NameConverter.ConvertName(instance.Member.Name), NameConverter.ConvertName(instance.EntityType.Name)));
 }
Пример #2
0
 /// <summary>
 /// Apply changes to the target
 /// </summary>
 public void Apply(IOneToManyCollectionInstance instance)
 {
     instance.Key.ForeignKey(String.Format("FK_{0}_{1}", instance.ChildType.Name, instance.EntityType.Name));
     instance.Key.Column(instance.EntityType.Name + "ID");
     instance.Cascade.AllDeleteOrphan();
     instance.Inverse();
 }
Пример #3
0
        public void Apply(IOneToManyCollectionInstance instance)
        {
            var originName = ConventionsUtilities
                             .CamelCaseToUpperCaseWithUnderscoreSeparator(instance.EntityType.Name);

            instance.Key.Column(originName + "_ID");
        }
 public void Apply(IOneToManyCollectionInstance instance)
 {
     instance.Key.Column(instance.EntityType.Name + "Id");
     instance.Inverse();
     instance.Access.CamelCaseField();
     instance.Cascade.AllDeleteOrphan();
 }
 public void Apply(IOneToManyCollectionInstance instance)
 {
     instance.Key.Column(instance.EntityType.Name + "Id");
     instance.Key.ForeignKey(instance.EntityType.Name + "_" + instance.ChildType.Name + "_FK");
     instance.Cascade.AllDeleteOrphan();
     instance.Inverse();
 }
 /// <inheritdoc />
 public void Apply(IOneToManyCollectionInstance instance)
 {
     // TODO: Change to readonly if write-behind 2nd level caching becomes possible
     instance.Cache.IncludeAll();
     instance.Cache.ReadWrite();
     instance.Cache.Region(RegionName);
 }
Пример #7
0
 public void Apply(IOneToManyCollectionInstance instance)
 {
     instance.LazyLoad();
     instance.AsBag();
     instance.Cascade.AllDeleteOrphan();
     instance.Inverse();
 }
Пример #8
0
 public void Apply(IOneToManyCollectionInstance instance)
 {
     instance.Access.CamelCaseField(CamelCasePrefix.Underscore);
     instance.Access.ReadOnlyPropertyThroughCamelCaseField(CamelCasePrefix.Underscore);
     instance.Cascade.All();
     instance.Inverse();
 }
Пример #9
0
 public virtual void Apply(IOneToManyCollectionInstance instance)
 {
     instance.Cascade.None();
     instance.Inverse();
     instance.Key.Column("id" + instance.Member.DeclaringType.Name);
     instance.LazyLoad();
 }
Пример #10
0
 public void Apply(IOneToManyCollectionInstance instance)
 {
     if (instance.TableName != null)
     {
         instance.Table(AlterTableName(instance.TableName));
     }
 }
Пример #11
0
 public void Apply(IOneToManyCollectionInstance instance)
 {
     if (instance.TableName != null)
     {
         instance.Table(AlterTableName(instance.TableName));
     }
 }
     public void Apply(IOneToManyCollectionInstance instance)
     {
 		if (instance.ChildType.IsSubclassOf(typeof(TenantEntity)))
         {
 				instance.ApplyFilter<TenantFilter>("tenantid = :tid");	
         }
     }
Пример #13
0
 public void Apply(IOneToManyCollectionInstance instance)
 {
     instance.LazyLoad();
     instance.AsBag();
     instance.Cascade.SaveUpdate();
     instance.Inverse();
 }
Пример #14
0
 public void Apply(IOneToManyCollectionInstance instance)
 {
     instance.Access.CamelCaseField(CamelCasePrefix.Underscore);
     instance.Access.ReadOnlyPropertyThroughCamelCaseField(CamelCasePrefix.Underscore);
     instance.Cascade.All();
     instance.Inverse();
 }
Пример #15
0
        public virtual void Apply(IOneToManyCollectionInstance instance)
        {
            var fk = instance.Member.GetCustomAttribute(typeof(ForeignKeyAttribute)) as ForeignKeyAttribute;

            instance.Key.Column(fk != null ? fk.Name : string.Format("{0}{1}", instance.EntityType.Name, "Id"));
            instance.LazyLoad();
        }
Пример #16
0
		public void Apply(IOneToManyCollectionInstance instance)
		{
			var abbreviation = AttributeHelper.GetTypeAttribute<AbbreviationAttribute>(instance.EntityType);
			var prefix = abbreviation == null
				? instance.EntityType.Name
				: abbreviation.Abbreviation;
			instance.Key.Column((prefix + "Id").EscapeColumnName());
		}
Пример #17
0
 public void Apply(IOneToManyCollectionInstance instance)
 {
     //foreach (var column in  instance.Key.Columns.OfType<ColumnInstance>()) {
     //    column.Set(x => x.Name, Layer.Defaults, column.Name.ToCamelCase());
     //}
     instance.Key.Column(string.Format("[{0}_id]", instance.Member.Name.ToCamelCase()));
     //instance.Key.Column(string.Format("[{0}_revision]", instance.Member.Name.ToCamelCase()));
 }
Пример #18
0
    public void Apply(IOneToManyCollectionInstance instance)
    {
        // looks for a Property which references the type containing the collection
        var referenceProperty = instance.ChildType.GetProperties()
                                .First(prop => prop.PropertyType == instance.EntityType);

        instance.Key.Column(referenceProperty.Name + "Id");
    }
        public void Apply(IOneToManyCollectionInstance instance)
        {
            string entity = instance.EntityType.Name;
            string member = instance.Member.Name;
            string child = instance.ChildType.Name;

            instance.Key.ForeignKey(string.Format("FK_{0}{1}_{2}", entity, member, child));
        }
Пример #20
0
 public void Apply(IOneToManyCollectionInstance instance)
 {
     instance.AsSet();
     instance.Inverse();
     instance.Where("StatusType!=-1");
     instance.Cascade.AllDeleteOrphan();
     instance.Generic();
 }
Пример #21
0
        public void Apply(IOneToManyCollectionInstance instance)
        {
            instance.Key.Column(instance.EntityType.Name + "Fk");

            instance.BatchSize(5);

            instance.Cascade.All();
        }
Пример #22
0
        public void Apply(IOneToManyCollectionInstance instance)
        {
            string entity = instance.EntityType.Name;
            string member = instance.Member.Name;
            string child  = instance.ChildType.Name;

            instance.Key.ForeignKey(string.Format("FK_{0}{1}_{2}", entity, member, child));
        }
        public void Apply(IOneToManyCollectionInstance instance)
        {
            string entity = instance.EntityType.Name;
            string member = instance.Member.Name;
            string child = instance.ChildType.Name;

            instance.Key.ForeignKey($"FK_{entity}{member}_{child}");
        }
Пример #24
0
        public void Apply(IOneToManyCollectionInstance instance)
        {
            var abbreviation = AttributeHelper.GetTypeAttribute <AbbreviationAttribute>(instance.EntityType);
            var prefix       = abbreviation == null
                                ? instance.EntityType.Name
                                : abbreviation.Abbreviation;

            instance.Key.Column((prefix + "Id").EscapeColumnName());
        }
 public void Apply(IOneToManyCollectionInstance instance)
 {
     var originName = ConventionsUtilities
         .CamelCaseToUpperCaseWithUnderscoreSeparator(instance.Member.Name);
     var targetName = ConventionsUtilities
         .CamelCaseToUpperCaseWithUnderscoreSeparator(instance.EntityType.Name);
     instance.Key.ForeignKey(String.Format("FK_{0}_{1}",
         originName, targetName));
 }
Пример #26
0
        public void Apply(IOneToManyCollectionInstance instance)
        {
            var tableName = GetTableName(instance);

            instance.AsSet();
            instance.Table(tableName);
            instance.CollectionType<PersistentMultiCultureStringType>();
            instance.Cascade.AllDeleteOrphan();
        }
Пример #27
0
 public void Apply(IOneToManyCollectionInstance instance)
 {
     if (instance.TableName.IsNotNull())
     {
         instance.Table(
             string.Format("`{0}_{1}`", Prefix, instance.TableName.Replace("`", ""))
             );
     }
 }
Пример #28
0
 public void Apply(IOneToManyCollectionInstance instance)
 {
     instance.Key.ForeignKey(
         string.Format(
             CultureInfo.InvariantCulture,
             FluentConfiguration.ForeignKeyTemplate,
             instance.EntityType.Name,
             Inflector.Pluralize(instance.Member.Name)));
 }
 public void Apply(IOneToManyCollectionInstance instance)
 {
     if (instance.TableName.IsNotNull())
     {
         instance.Table(
             string.Format("`{0}_{1}`", Prefix, instance.TableName.Replace("`", ""))
         );
     }
 }
Пример #30
0
        /// <summary>
        /// one to many
        /// </summary>
        /// <remarks>HasMany Map</remarks>
        public void Apply(IOneToManyCollectionInstance instance)
        {
            instance.Key.ForeignKey(GetForeignKeyName(instance.ChildType.Name, instance.EntityType.Name));
            instance.KeyNullable();
            instance.KeyUpdate();

            instance.Cache.ReadWrite();
            instance.Cache.Region(instance.EntityType.Name);
        }
Пример #31
0
        public void Apply(IOneToManyCollectionInstance instance)
        {
            var type = instance.Member.GetUnderlyingType();

            if (!typeof(IDictionary).IsAssignableFrom(type) && !type.IsAssignableToGenericType(typeof(IDictionary <,>))) //Map must have inverse set to false
            {
                instance.Inverse();
            }

            //var inverseAttribute = instance.ChildType.GetCustomAttribute<InverseAttribute>();
            var inverseAttribute = instance.Member.GetCustomAttribute <InverseAttribute>();

            if (instance.EntityType.IsAssignableToGenericType(typeof(Document <, , ,>)))
            {
                var mapping = GetMapping(instance.Key.Columns.First());
                mapping.Set(x => x.Name, Layer.UserSupplied, "ParentId");
            }

            if (inverseAttribute != null)
            {
                switch (inverseAttribute.Type)
                {
                case InverseAttribute.CascadeType.None:
                    instance.Cascade.None();
                    break;

                case InverseAttribute.CascadeType.All:
                    instance.Cascade.All();
                    break;

                case InverseAttribute.CascadeType.AllDeleteOrphan:
                    instance.Cascade.AllDeleteOrphan();
                    break;

                case InverseAttribute.CascadeType.Delete:
                    instance.Cascade.Delete();
                    break;

                case InverseAttribute.CascadeType.Merge:
                    instance.Cascade.Merge();
                    break;

                case InverseAttribute.CascadeType.SaveUpdate:
                    instance.Cascade.SaveUpdate();
                    break;

                case InverseAttribute.CascadeType.DeleteOrphan:
                    instance.Cascade.DeleteOrphan();
                    break;
                }
            }
            else
            {
                instance.Cascade.AllDeleteOrphan();
            }
        }
Пример #32
0
        public void Apply(IOneToManyCollectionInstance instance)
        {
            var type = GetUnderlyingType(instance.Member);

            if (!typeof(IDictionary).IsAssignableFrom(type) && !IsAssignableToGenericType(type, (typeof(IDictionary <,>)))) //Map must have inverse set to false
            {
                instance.Inverse();
            }
            instance.Cascade.AllDeleteOrphan();
        }
        public void Apply(IOneToManyCollectionInstance instance)
        {
            instance.Key.Column(instance.EntityType.Name + "Id");
            var parent = instance.Relationship.EntityType.Name.Pluralize();
            instance.Key.ForeignKey(
                $"FK_{instance.StringIdentifierForModel.Pluralize()}_For_{parent}");

            instance.Cascade.AllDeleteOrphan();
            instance.Inverse();
        }
Пример #34
0
        public void Apply(IOneToManyCollectionInstance instance)
        {
            var originName = ConventionsUtilities
                             .CamelCaseToUpperCaseWithUnderscoreSeparator(instance.Member.Name);
            var targetName = ConventionsUtilities
                             .CamelCaseToUpperCaseWithUnderscoreSeparator(instance.EntityType.Name);

            instance.Key.ForeignKey(String.Format("FK_{0}_{1}",
                                                  originName, targetName));
        }
Пример #35
0
 public void Apply(IOneToManyCollectionInstance instance)
 {
     instance.LazyLoad();
     instance.BatchSize(5);
     instance.Access.CamelCaseField(CamelCasePrefix.Underscore);
     instance.Cascade.All();
     instance.Key.Column(Inflector.Underscore(instance.EntityType.Name) + "_id");
     instance.Key.ForeignKey(string.Format("fk_{0}_{1}",
         NamingHelper.GetPrefixedName(instance.EntityType),
         Inflector.Underscore(instance.ChildType.Name).ToLower()));
 }
Пример #36
0
        public void Apply(IOneToManyCollectionInstance instance)
        {
            instance.Key.Column(instance.EntityType.Name + "Id");
            var parent = instance.Relationship.EntityType.Name.Pluralize();

            instance.Key.ForeignKey(
                $"FK_{instance.StringIdentifierForModel.Pluralize()}_For_{parent}");

            instance.Cascade.AllDeleteOrphan();
            instance.Inverse();
        }
Пример #37
0
        /// <summary>
        /// Applies this has many convention to the specified <see cref = "IOneToManyCollectionInstance" />.
        /// </summary>
        /// <param name="instance">An <see cref = "IOneToManyCollectionInstance" />.</param>
        public void Apply(IOneToManyCollectionInstance instance)
        {
            if (instance == null)
            {
                throw new ArgumentNullException("instance");
            }

            instance.Key.Column(instance.EntityType.Name + "Id");
            instance.Cascade.AllDeleteOrphan();
            instance.Inverse();
        }
Пример #38
0
 public void Apply(IOneToManyCollectionInstance instance)
 {
     instance.Cache.ReadWrite();
     instance.Cascade.SaveUpdate();
     instance.Cascade.AllDeleteOrphan();
     instance.Fetch.Subselect();
     instance.Inverse();
     instance.Relationship.NotFound.Ignore();
     instance.Key.ForeignKey(string.Format("FK_{0}_{1}", instance.ChildType.Name, instance.EntityType.Name));
     instance.Where("(IsDeleted = 'False' or IsDeleted = 0 or IsDeleted is null)");
 }
Пример #39
0
 public void Apply(IOneToManyCollectionInstance instance)
 {
     instance.Cache.ReadWrite();
     instance.Cascade.SaveUpdate();
     instance.Cascade.AllDeleteOrphan();
     instance.Fetch.Subselect();
     instance.Inverse();
     instance.Relationship.NotFound.Ignore();
     instance.Key.ForeignKey(string.Format("FK_{0}_{1}", instance.ChildType.Name, instance.EntityType.Name));
     instance.Where("(IsDeleted = 'False' or IsDeleted = 0 or IsDeleted is null)");
 }
Пример #40
0
        public void Apply(IOneToManyCollectionInstance instance)
        {
            instance.Key.Column(instance.EntityType.Name.ToDatabaseName() + "_ID");
            instance.Cascade.AllDeleteOrphan();
            //instance.Inverse();

            if (typeof (IPermanent).IsAssignableFrom(instance.ChildType))
            {
                instance.ApplyFilter<IsDeletedFilter>("IS_DELETED = :DeleteFlag");
            }
            Debug.WriteLine("----HasManyConvention----"+instance.EntityType.Name.ToDatabaseName() + "_ID" + instance.EntityType.ToString()+" "+instance.ChildType.ToString());
        }
Пример #41
0
        public void Apply(IOneToManyCollectionInstance instance)
        {
            instance.Key.Column(instance.EntityType.Name.ToDatabaseName() + "_ID");
            instance.Cascade.AllDeleteOrphan();
            //instance.Inverse();

            if (typeof(IPermanent).IsAssignableFrom(instance.ChildType))
            {
                instance.ApplyFilter <IsDeletedFilter>("IS_DELETED = :DeleteFlag");
            }
            Debug.WriteLine("----HasManyConvention----" + instance.EntityType.Name.ToDatabaseName() + "_ID" + instance.EntityType.ToString() + " " + instance.ChildType.ToString());
        }
Пример #42
0
            public void Apply(IOneToManyCollectionInstance instance)
            {
                var prop = instance.Member as PropertyInfo;

                if (prop != null && prop.PropertyType.Closes(typeof(IList <>)))
                {
                    instance.AsList();
                    instance.Key.Column(instance.Relationship.EntityType.Name + "Id");
                    instance.Index.Column("Ordinal");
                }
                instance.Cascade.AllDeleteOrphan();
            }
Пример #43
0
 public void Apply(IOneToManyCollectionInstance instance)
 {
     try
     {
         instance.Key.ForeignKey(
             string.Format("FK_{0}_{1}_{2}",
                           instance.Relationship.Class.Name.CleanBaseClassName(),
                           instance.EntityType.Name.CleanBaseClassName(),
                           instance.Key.Columns.First().Name.Trim('[', ']')).Trim('_'));
     }
     catch { }
 }
        public void Apply(IOneToManyCollectionInstance instance)
        {
            instance.Cascade.AllDeleteOrphan();

            var propertyName             = instance.Member.Name;
            var parentType               = instance.Member.DeclaringType;
            var parentCollectionProperty = parentType.GetInstanceProperties().FirstOrDefault(x => x.Name == propertyName);

            if (parentCollectionProperty == null)
            {
                return;
            }

            var parentCollectionPropertyBackingFieldName = _propertyNameToBackingFieldNameFunc?.Invoke(propertyName)
                                                           ?? "_" + Char.ToLower(propertyName[0]) + propertyName.Substring(1);

            var parentCollectionPropertyBackingField = parentType.GetInstanceFields().FirstOrDefault(x => x.Name == parentCollectionPropertyBackingFieldName);

            if (parentCollectionPropertyBackingField != null)
            {
                instance.Access.ReadOnlyPropertyThroughCamelCaseField(CamelCasePrefix.Underscore);
                _setInverseAndAsSet(parentCollectionPropertyBackingField.PropertyType);
            }
            else
            {
                _setInverseAndAsSet(parentCollectionProperty.PropertyType);
            }

            void _setInverseAndAsSet(Type collectionType)
            {
                if (collectionType.IsSubclassOfRawGeneric(typeof(IList <>)))
                {
                    return;
                }
                if (_doesChildReferenceTheParent())
                {
                    instance.Inverse();
                }
                instance.AsSet();
            }

            bool _doesChildReferenceTheParent()
            {
#if NET40
                var childType = parentCollectionProperty.PropertyType.GetGenericArguments()[0];
#else
                var childType = parentCollectionProperty.PropertyType.GenericTypeArguments[0];
#endif
                var parentPropertyInChildType = childType.GetInstanceProperties().FirstOrDefault(x => x.PropertyType == parentType);
                return(parentPropertyInChildType != null);
            }
        }
Пример #45
0
        public void Apply(IOneToManyCollectionInstance instance)
        {
            _collectionCascadeInstanceAction?.Invoke(instance.Cascade);

            var propertyName             = instance.Member.Name;
            var parentType               = instance.Member.DeclaringType;
            var parentCollectionProperty = parentType.GetInstanceProperties().FirstOrDefault(x => x.Name == propertyName);

            if (parentCollectionProperty == null)
            {
                return;
            }

            var parentCollectionPropertyBackingFieldName = _getBackingFieldNameFromPropertyName(propertyName);

            var parentCollectionPropertyBackingField = parentType.GetInstanceFields().FirstOrDefault(x => x.Name == parentCollectionPropertyBackingFieldName);

            if (parentCollectionPropertyBackingField != null)
            {
                _setCollectionInstanceAccess(instance.Access);
                _markAsInverseIfPossibleAndSetAsSetOrAsList(parentCollectionPropertyBackingField.PropertyType);
            }
            else
            {
                _markAsInverseIfPossibleAndSetAsSetOrAsList(parentCollectionProperty.PropertyType);
            }

            void _markAsInverseIfPossibleAndSetAsSetOrAsList(Type collectionType)
            {
                if (collectionType.IsSubclassOfRawGeneric(typeof(IList <>)))
                {
                    instance.AsList();
                    return;
                }
                if (_doesChildReferenceTheParent())
                {
                    instance.Inverse();
                }
                instance.AsSet();
            }

            bool _doesChildReferenceTheParent()
            {
#if NET40
                var childType = parentCollectionProperty.PropertyType.GetGenericArguments()[0];
#else
                var childType = parentCollectionProperty.PropertyType.GenericTypeArguments[0];
#endif
                var parentPropertyInChildType = childType.GetInstanceProperties().FirstOrDefault(x => x.PropertyType == parentType);
                return(parentPropertyInChildType != null);
            }
        }
Пример #46
0
        public void Apply(IOneToManyCollectionInstance instance)
        {
            if (instance == null)
            {
                return;
            }

            instance.Key.ForeignKey($"FK_{instance.Member.Name}_{instance.EntityType.Name}");
            if (instance.Member.IsDefined(typeof(RequiredAttribute), false))
            {
                instance.Not.KeyNullable();
            }
        }
Пример #47
0
    public void Apply(IOneToManyCollectionInstance instance)
    {
        var mappingfield = instance.Key.Columns.First().GetType()
                           .GetField("mapping", BindingFlags.Instance | BindingFlags.NonPublic);
        var columnMapping = (ColumnMapping)mappingfield.GetValue(instance.Key.Columns.First());

        if (!columnMapping.HasValue(c => c.Index))
        {
            var typename = instance.Member.DeclaringType.Name;
            columnMapping.Index = string.Format("index_{0}_{1}",
                                                typename.ToLower(), instance.Member.Name.ToLower());
        }
    }
 public void Apply(IOneToManyCollectionInstance instance)
 {
     instance.Access.ReadOnlyPropertyThroughCamelCaseField(CamelCasePrefix.Underscore);
     instance.Cascade.AllDeleteOrphan();            
     if (instance.OtherSide == null)
         instance.Not.Inverse();
     else
         instance.Inverse();
     instance.BatchSize(500);
     instance.AsSet();
     instance.Not.KeyNullable();
     instance.LazyLoad();
 }
        /// <summary>
        /// Applies Key based on type.
        /// </summary>
        /// <param name="instance">The instance.</param>
        public void Apply(IOneToManyCollectionInstance instance)
        {
            var entityType = instance.EntityType;

            // name the key field
            var key = entityType.Name;

            if (typeof(ILookup).IsAssignableFrom(entityType))
            {
                key = key + "Lkp";
            }

            instance.Key.Column(key + "Key");
            instance.Inverse();
        }
Пример #50
0
        /// <summary>
        /// Sets cascade mode to AllDeleteOrphan for all types except Aggregate roots.
        /// Aggregate roots cascade mode is None.
        /// </summary>
        /// <param name="instance">The instance.</param>
        public void Apply( IOneToManyCollectionInstance instance )
        {
            var rootSubclass =
                typeof( AbstractAggregateRoot ).IsAssignableFrom (
                    instance.Relationship.Class.GetUnderlyingSystemType () );

            if ( rootSubclass )
            {
                instance.Cascade.None ();
            }
            else
            {
                instance.Cascade.AllDeleteOrphan ();
            }
        }
Пример #51
0
        /// <summary>
        /// Applies access based on type.
        /// </summary>
        /// <param name="instance">The instance.</param>
        public void Apply( IOneToManyCollectionInstance instance )
        {
            var entityType = instance.EntityType;
            var propertyName = instance.Member.Name;
            var propertyInfo = entityType.GetProperty ( propertyName, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance );

            if ( propertyInfo.IsAutoProperty () )
            {
                instance.Access.BackField ();
            }
            else
            {
                instance.Access.CamelCaseField ( CamelCasePrefix.Underscore );
            }
        }
Пример #52
0
 public void Apply(IOneToManyCollectionInstance instance)
 {
     instance.Access.ReadOnlyPropertyThroughCamelCaseField();
     instance.Cascade.AllDeleteOrphan();
     instance.AsSet();
     instance.BatchSize(25);
     if (instance.OtherSide == null)
     {
         instance.Not.Inverse();
     }
     else
     {
         instance.Inverse();
     }
     instance.Not.KeyNullable();
 }
Пример #53
0
        public void Apply(IOneToManyCollectionInstance instance)
        {
            instance.ApplyFilter<DeletedFilter>();

            instance.Key.Column(instance.EntityType.Name + "Fk");

            //demonstrate business requirement - all has many relation should be fethced eagerly
            //to alleviate classic N+1 problem when iterating an "entity list property" and 
            //access properties on each iterator item
            //set batch 5 to eager fetch at most 5 entities when accessing a collection property.
            //its a good candidate for a general purpose query performance tuning
            //Note: the global class level adonet.batch_size can be set in nhibernate.config file
            instance.BatchSize(5);


            instance.Cascade.All();
        }
        public void Apply(IOneToManyCollectionInstance instance)
        {
            instance.Cascade.AllDeleteOrphan();

            var propertyName = instance.Member.Name;
            var declaringType = instance.Member.DeclaringType;
            var property = declaringType.GetInstanceProperties().FirstOrDefault(x => x.Name == propertyName);
            if (property == null) return;
            var backingFieldName = "_" + Char.ToLower(propertyName[0]) + propertyName.Substring(1);
            var field = declaringType.GetInstanceFields().FirstOrDefault(x => x.Name == backingFieldName);
            if (field != null)
            {
                instance.Access.ReadOnlyPropertyThroughCamelCaseField(CamelCasePrefix.Underscore);
                SetInverseAndAsSetIfNotAList(field.PropertyType, instance);
            }
            else
            {
                SetInverseAndAsSetIfNotAList(property.PropertyType, instance);
            }
        }
 public void Apply(IOneToManyCollectionInstance instance) {
     instance.Fetch.Select();
     instance.Cache.ReadWrite();
 }
Пример #56
0
 public void Apply(IOneToManyCollectionInstance instance)
 {
     DefaultCascade.All();
 }
 public void Apply(IOneToManyCollectionInstance instance)
 {
     instance.Key.ForeignKey(string.Format("{0}_{1}_FK", instance.Member.Name, instance.EntityType.Name));
 }
 public void Apply(IOneToManyCollectionInstance instance)
 {
     instance.Cascade.AllDeleteOrphan();
 }
 public void Apply(IOneToManyCollectionInstance instance)
 {
     instance.Fetch.Select();
 }
Пример #60
0
 public void Apply(IOneToManyCollectionInstance instance)
 {
     instance.Key.Column("test_column");
     instance.Key.ForeignKey("test_fk");
 }