Example #1
0
        public void Apply(IJoinInstance instance)
        {
            string colName = PersistenceModelGenerator
                             .GetColumnName(instance.EntityType)
                             .ToDatabaseName()
                             + "_ID";

            instance.Key.Column(colName);
        }
        public void Apply(IJoinedSubclassInstance instance)
        {
            string colName = PersistenceModelGenerator
                             .GetColumnName(instance.Type.BaseType)
                             .ToDatabaseName()
                             + "_ID";

            instance.Key.Column(colName);
            Debug.WriteLine("----IJoinedSubclassConvention----" + instance.Type);
        }
Example #3
0
        public void Apply(IManyToManyCollectionInstance instance)
        {
            string entityDatabaseName = PersistenceModelGenerator.GetColumnName(instance.EntityType).ToDatabaseName();
            string childDatabaseName  = PersistenceModelGenerator.GetColumnName(instance.ChildType).ToDatabaseName();
            string name = GetTableName(entityDatabaseName, childDatabaseName);

            instance.Table(name);

            instance.Key.Column(entityDatabaseName + "_ID");
            instance.Relationship.Column(childDatabaseName + "_ID");
            instance.Cascade.AllDeleteOrphan();
            Debug.WriteLine("----HasManyToManyConvention----" + instance.EntityType + " " + instance.ChildType);
        }
Example #4
0
        private void InitMapping(FluentConfiguration fluentConfiguration)
        {
            fluentConfiguration.Mappings(
                x =>
            {
                x.AutoMappings.Add(PersistenceModelGenerator.Generate(new string[] { "NHibernateTest.exe" },
                                                                      new string[] { "NHibernateTest.exe" }));
                x.FluentMappings.Add <IsDeletedFilter>();

                x.AutoMappings.ExportTo(@"D:\Temp");
            });

            //fluentConfiguration.Mappings(m => m.FluentMappings.Add<ClassesMap>());
            //fluentConfiguration.Mappings(m => m.FluentMappings.Add<StudentMap>());
            //fluentConfiguration.Mappings(m => m.FluentMappings.Add<CourseMap>());
        }
        public void Apply(ICollectionInstance instance)
        {
            string colName;
            Type   entityType = instance.EntityType;
            Type   childType  = instance.ChildType;

            if (entityType == childType)
            {
                colName = "PARENT_ID";
            }
            else
            {
                colName = PersistenceModelGenerator.GetColumnName(entityType).ToDatabaseName() + "_ID";
            }
            instance.Key.Column(colName);
            instance.Cascade.AllDeleteOrphan();
            Debug.WriteLine("----CollectionConvention----" + entityType.ToString() + " " + childType.ToString());
        }