Beispiel #1
0
        protected override CollectionMapping GetCollectionMapping()
        {
            var collection = base.GetCollectionMapping();

            // key columns
            if (parentKeyColumns.Count == 0)
            {
                collection.Key.AddColumn(Layer.Defaults, new ColumnMapping(EntityType.Name + "_id"));
            }

            foreach (var column in parentKeyColumns)
            {
                collection.Key.AddColumn(Layer.UserSupplied, column.Clone());
            }

            if (collection.Relationship != null)
            {
                // child columns
                if (childKeyColumns.Count == 0)
                {
                    ((ManyToManyMapping)collection.Relationship).AddColumn(Layer.Defaults, new ColumnMapping(typeof(TChild).Name + "_id"));
                }

                foreach (var column in childKeyColumns)
                {
                    ((ManyToManyMapping)collection.Relationship).AddColumn(Layer.UserSupplied, column.Clone());
                }
            }

            // HACK: Index only on list and map - shouldn't have to do this!
            if (index != null)
            {
#pragma warning disable 612,618
                collection.Set(x => x.Index, Layer.Defaults, index.GetIndexMapping());
#pragma warning restore 612,618
            }

            // HACK: shouldn't have to do this!
            if (manyToManyIndex != null && collection.Collection == Collection.Map)
#pragma warning disable 612,618
            {
                collection.Set(x => x.Index, Layer.Defaults, manyToManyIndex.GetIndexMapping());
            }
#pragma warning restore 612,618

            return(collection);
        }
        protected override ICollectionMapping GetCollectionMapping()
        {
            var collection = base.GetCollectionMapping();

            // key columns
            if (parentKeyColumns.Count == 0)
            {
                collection.Key.AddDefaultColumn(new ColumnMapping {
                    Name = entity.Name + "_id"
                });
            }

            foreach (var column in parentKeyColumns)
            {
                collection.Key.AddColumn(column);
            }

            if (collection.Relationship != null)
            {
                // child columns
                if (childKeyColumns.Count == 0)
                {
                    ((ManyToManyMapping)collection.Relationship).AddDefaultColumn(new ColumnMapping {
                        Name = typeof(TChild).Name + "_id"
                    });
                }

                foreach (var column in childKeyColumns)
                {
                    ((ManyToManyMapping)collection.Relationship).AddColumn(column);
                }
            }

            // HACK: Index only on list and map - shouldn't have to do this!
            if (index != null && collection is IIndexedCollectionMapping)
            {
                ((IIndexedCollectionMapping)collection).Index = index.GetIndexMapping();
            }

            // HACK: shouldn't have to do this!
            if (manyToManyIndex != null && collection is MapMapping)
            {
                ((MapMapping)collection).Index = manyToManyIndex.GetIndexMapping();
            }

            return(collection);
        }
Beispiel #3
0
        public override ICollectionMapping GetCollectionMapping()
        {
            var collection = base.GetCollectionMapping();

            // key columns
            if (parentColumns.Count == 0)
            {
                collection.Key.AddDefaultColumn(new ColumnMapping {
                    Name = entity.Name + "_id"
                });
            }

            foreach (var column in parentColumns)
            {
                collection.Key.AddColumn(new ColumnMapping {
                    Name = column
                });
            }

            // child columns
            if (childColumns.Count == 0)
            {
                ((ManyToManyMapping)collection.Relationship).AddDefaultColumn(new ColumnMapping {
                    Name = typeof(TChild).Name + "_id"
                });
            }

            foreach (var column in childColumns)
            {
                ((ManyToManyMapping)collection.Relationship).AddColumn(new ColumnMapping {
                    Name = column
                });
            }

            // HACK: shouldn't have to do this!
            if (manyToManyIndex != null && collection is MapMapping)
            {
                ((MapMapping)collection).Index = manyToManyIndex.GetIndexMapping();
            }

            return(collection);
        }
Beispiel #4
0
        protected override CollectionMapping GetCollectionMapping()
        {
            var collection = base.GetCollectionMapping();

            if (keyColumns.Count() == 0)
            {
                collection.Key.AddColumn(Layer.Defaults, new ColumnMapping(entity.Name + "_id"));
            }

            foreach (var column in keyColumns)
            {
                collection.Key.AddColumn(Layer.UserSupplied, column);
            }

            // HACK: shouldn't have to do this!
            if (manyToManyIndex != null && collection.Collection == Collection.Map)
#pragma warning disable 612,618
            {
                collection.Set(x => x.Index, Layer.Defaults, manyToManyIndex.GetIndexMapping());
            }
#pragma warning restore 612,618

            return(collection);
        }
        protected override ICollectionMapping GetCollectionMapping()
        {
            var collection = base.GetCollectionMapping();

            if (keyColumns.Count() == 0)
            {
                collection.Key.AddDefaultColumn(new ColumnMapping {
                    Name = entity.Name + "_id"
                });
            }

            foreach (var column in keyColumns)
            {
                collection.Key.AddColumn(column);
            }

            // HACK: shouldn't have to do this!
            if (manyToManyIndex != null && collection is MapMapping)
            {
                ((MapMapping)collection).Index = manyToManyIndex.GetIndexMapping();
            }

            return(collection);
        }