Exemplo n.º 1
0
        public AuditEntitiesConfiguration(IDictionary <String, String> properties, String revisionInfoEntityName)
        {
            this.RevisionInfoEntityName = revisionInfoEntityName;

            auditTablePrefix = Toolz.GetProperty(properties,
                                                 "NHibernate.envers.audit_table_prefix",
                                                 "NHibernate.envers.auditTablePrefix",
                                                 "");
            auditTableSuffix = Toolz.GetProperty(properties,
                                                 "NHibernate.envers.audit_table_suffix",
                                                 "NHibernate.envers.auditTableSuffix",
                                                 "_AUD");

            OriginalIdPropName = "originalId";

            RevisionFieldName = Toolz.GetProperty(properties,
                                                  "NHibernate.envers.revision_field_name",
                                                  "NHibernate.envers.revisionFieldName",
                                                  "REV");

            RevisionTypePropName = Toolz.GetProperty(properties,
                                                     "NHibernate.envers.revision_type_field_name",
                                                     "NHibernate.envers.revisionTypeFieldName",
                                                     "REVTYPE");
            RevisionTypePropType = "byte";

            customAuditTablesNames = new Dictionary <String, String>();

            RevisionNumberPath   = OriginalIdPropName + "." + RevisionFieldName + ".id";
            revisionPropBasePath = OriginalIdPropName + "." + RevisionFieldName + ".";
        }
Exemplo n.º 2
0
        public GlobalConfiguration(IDictionary <string, string> properties)
        {
            String generateRevisionsForCollectionsStr = Toolz.GetProperty(properties,
                                                                          "NHibernate.Envers.revision_on_collection_change",
                                                                          "NHibernate.Envers.revisionOnCollectionChange",
                                                                          "true");

            generateRevisionsForCollections = Boolean.Parse(generateRevisionsForCollectionsStr);

            String ignoreOptimisticLockingPropertyStr = Toolz.GetProperty(properties,
                                                                          "NHibernate.Envers.do_not_audit_optimistic_locking_field",
                                                                          "NHibernate.Envers.doNotAuditOptimisticLockingField",
                                                                          "true");

            doNotAuditOptimisticLockingField = Boolean.Parse(ignoreOptimisticLockingPropertyStr);

            String storeDataDeletedEntityStr = Toolz.GetProperty(properties,
                                                                 "NHibernate.Envers.store_data_at_delete",
                                                                 "NHibernate.Envers.storeDataAtDelete",
                                                                 "false");

            storeDataAtDelete = Boolean.Parse(storeDataDeletedEntityStr);

            defaultSchemaName  = Toolz.GetProperty(properties, "NHibernate.Envers.default_schema", "");
            defaultCatalogName = Toolz.GetProperty(properties, "NHibernate.Envers.default_catalog", "");

            //TODO Simon - see if we need to parametrize this, HSQLDialect (HSQLDB) not implemented for NHibernate
            correlatedSubqueryOperator = "org.hibernate.dialect.HSQLDialect".Equals(
                Toolz.GetProperty(properties, "hibernate.dialect", "")) ? "in" : "=";
        }