Exemple #1
0
        private void CreateIndexMapping(Action <IndexPart> customIndex)
        {
            var indexPart = new IndexPart(typeof(T));

            if (customIndex != null)
            {
                customIndex(indexPart);
            }

            indexMapping = indexPart.GetIndexMapping();
        }
Exemple #2
0
        private void CreateIndexMapping(Action <IndexPart> customIndex)
        {
            var indexPart = new IndexPart(typeof(T));

            if (customIndex != null)
            {
                customIndex(indexPart);
            }

#pragma warning disable 612,618
            indexMapping = indexPart.GetIndexMapping();
#pragma warning restore 612,618
        }
Exemple #3
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);
        }