/// <summary> /// 初始化DbSessionContext /// </summary> /// <param name="level"></param> /// <param name="nhxmlPath"></param> /// <param name="autoExecuteSchema">是否自动执行映射生成的初始化DB脚本(适合测试环境,总是创建新表)</param> /// <param name="autoUpdateSchema">是否更新数据库架构(适合测试环境)</param> public DbSessionContext(IsolationLevel?level, string nhxmlPath, bool autoExecuteSchema, bool autoUpdateSchema) { Interlocked.CompareExchange(ref _configuration, new Configuration(), null); _configuration.Configure(nhxmlPath ?? _defaultNhXmlConfigPath); _level = level; _map = new EntityClassMap(); _autoExecuteSchema = autoExecuteSchema; _autoUpdateSchema = autoExecuteSchema; }
/// <summary> /// 创建实体映射 /// </summary> /// <param name="map"></param> protected abstract void OnEntityMap(EntityClassMap map);