public static bool ReadConfig() { if (!Directory.Exists(savepath)) Directory.CreateDirectory(savepath); if (!File.Exists(filepath)) { try { CreateConfig(); } catch { return false; } return true; } try { using (var sr = new StreamReader(filepath)) { config = JsonConvert.DeserializeObject<Cfg>(sr.ReadToEnd()); } } catch (Exception ex) { Log.ConsoleError(ex.Message); return false; } return true; }
/// <summary> /// calls the InvokePSCmd (Invoke Powershell Commands) function of each item of the ConfigList List /// </summary> public void LaunchPSCmds() { foreach (ConfigOption Cfg in ConfigList) { Cfg.InvokePSCmd(); } }
private void insertCVideoBackground(StorageVideo storageVideo) { Cfg cfg = new Cfg(); cfg.screenWidth = Convert.ToInt32(pageTemplate.ActualWidth); cfg.screenHeight = Convert.ToInt32(pageTemplate.ActualHeight); DControl ctl = new DControl(); ctl.name = "CVideoBackground"; ctl.width = cfg.screenWidth; ctl.height = cfg.screenHeight; ctl.left = 0; ctl.top = 0; ctl.storageId = storageVideo.id; StorageVideoDto dto = StorageVideoUtil.convert(storageVideo); StorageImage storageImage = storageImageBll.get(dto.storageImageId); dto.storageImageUrl = storageImage?.url; CVideoBackground cVideoBackground1 = new CVideoBackground(dto, true); cVideoBackground1.Name = "CVideoBackground"; cVideoBackground1.HorizontalAlignment = HorizontalAlignment.Left; cVideoBackground1.VerticalAlignment = VerticalAlignment.Top; cVideoBackground1.Margin = new Thickness(ctl.left, ctl.top, 0, 0); cVideoBackground1.Width = ctl.width; cVideoBackground1.Height = ctl.height; pageTemplate.backgroundVideo.Children.Add(cVideoBackground1); }
public void VerifyChildIdColumnName() { var auditName = TestAssembly + ".Integration.Inheritance.Entities.ChildPrimaryKeyJoinEntity_AUD"; var keyColumn = (Column)Cfg.GetClassMapping(auditName).Key.ColumnIterator.First(); Assert.AreEqual("OtherId", keyColumn.Name); }
protected override void Configure(Cfg.Configuration configuration) { if(Dialect is MsSql2000Dialect) { configuration.SetProperty( Cfg.Environment.SqlExceptionConverter, typeof(MSSQLExceptionConverterExample).AssemblyQualifiedName); } if (Dialect is Oracle8iDialect) { configuration.SetProperty( Cfg.Environment.SqlExceptionConverter, typeof(OracleClientExceptionConverterExample).AssemblyQualifiedName); } if (Dialect is PostgreSQLDialect) { configuration.SetProperty( Cfg.Environment.SqlExceptionConverter, typeof(PostgresExceptionConverterExample).AssemblyQualifiedName); } if (Dialect is FirebirdDialect) { configuration.SetProperty( Cfg.Environment.SqlExceptionConverter, typeof(FbExceptionConverterExample).AssemblyQualifiedName); } }
//protected override bool AppliesTo(Dialect.Dialect dialect) //{ // // this test work only with Field interception (NH-1618) // return FieldInterceptionHelper.IsInstrumented( new Person() ); //} protected override void Configure(Cfg.Configuration configuration) { configuration.SetProperty(Environment.ProxyFactoryFactoryClass, typeof(NHibernate.ByteCode.Castle.ProxyFactoryFactory).AssemblyQualifiedName); configuration.SetProperty(Environment.MaxFetchDepth, "2"); configuration.SetProperty(Environment.UseSecondLevelCache, "false"); }
private static void SetupSqlServerOdbc(Cfg.Configuration cfg) { var connStr = cfg.Properties[Cfg.Environment.ConnectionString]; using (var conn = new OdbcConnection(connStr.Replace("Database=nhibernateOdbc", "Database=master"))) { conn.Open(); using (var cmd = conn.CreateCommand()) { cmd.CommandText = "drop database nhibernateOdbc"; try { cmd.ExecuteNonQuery(); } catch(Exception e) { Console.WriteLine(e); } cmd.CommandText = "create database nhibernateOdbc"; cmd.ExecuteNonQuery(); } } }
public void ChildRevColumnTypeShouldBeOfIntType() { var auditName = TestAssembly + ".Integration.Inheritance.Entities.ChildEntity_AUD"; var columns = Cfg.GetClassMapping(auditName).Key.ColumnIterator; Assert.AreEqual("int", ((Column)columns.Last()).SqlType); }
public ServiceExecutionResult Execute() { if (Methods == null) { if (Types == null) { throw new ServiceExecutionException( $"{nameof(CfgParserService)} must be executed with inputs. Input can " + "be passed via constructor or by executing the service after " + nameof(DecompilationService)); } else { Methods = Types.SelectMany(t => t.Methods).Where(m => m.HasBody); } } Cfg = new Cfg(); foreach (var method in Methods) { ComputeMethodCfg(method); } Log.WriteError("Timed out methods: " + TimeoutMethodCount); return(new CfgParserResult(Cfg, Methods)); }
protected override void Configure(Cfg.Configuration configuration) { configuration.SetProperty(Cfg.Environment.BatchSize, "10"); configuration.SetProperty( Cfg.Environment.SqlExceptionConverter, typeof (MSSQLExceptionConverterExample).AssemblyQualifiedName); }
public MainOperatorForm() { InitializeComponent(); m_Cfg = Cfg.ReadConfig(); // UserInfo usr = new UserInfo(new DepInfo("asdasd"), "asdasdas", "asdasdas"); // propertyGrid1.SelectedObject = usr; }
public static void LoadUserData(IServiceProvider serviceProvider, string appRootPath) { var exchangeServices = serviceProvider.GetServices <IExchangeService>(); Mapper.Initialize(cfg => { cfg.AddProfile <DataProfile>(); foreach (var exchangeService in exchangeServices) { exchangeService.ConfigureMap(cfg); } cfg.CreateMap <Candle, CandleDto>() .ForMember(d => d.Timestamp, o => o.MapFrom(s => s.Timestamp)) .ForMember(d => d.Instrument, m => m.Ignore()) .ForMember(d => d.ExchangeName, m => m.Ignore()) .ForMember(d => d.Period, m => m.Ignore()); cfg.CreateMap <PositionDto, PositionDto>() .ForAllMembers(o => o.Condition((s, d, srcM, destM) => srcM != null)); }); Cfg.InitialiseConfig(serviceProvider.GetServices <IConfig>()); }
private static T ConfigFactory <T>(string name = null) where T : IConfig { var configName = name ?? typeof(T).Name.Replace("Config", ""); Logger.Log(LogLevel.Info, $"Loading {configName} application data..."); try { var config = JsonConvert.DeserializeObject <T>(Cfg.GetConfigJsonAsync(configName).GetAwaiter().GetResult()); Logger.Log(LogLevel.Info, $"{configName} application data load complete"); config.LoadUserConfigAsync(Cfg.AppDataPath).GetAwaiter().GetResult(); Logger.Log(LogLevel.Info, $"{configName} user data load complete"); return(config); } catch (Exception e) { Logger.Log(LogLevel.Fatal, $"Unable to load {configName} application data"); Logger.Log(LogLevel.Fatal, e.Message); Logger.Log(LogLevel.Fatal, e.StackTrace); throw; } }
public void AccessTest() { Cfg cfg = new Cfg(); Assert.AreEqual(false, cfg.isAnalyzerSilent, "enum"); Assert.IsNotNull(cfg.cn, "connstr"); }
static void generatorsign() { //用我的私钥和公钥用来测试接口编写 string privateKey = Cfg.Get("privateKey"); string publicKey = Cfg.Get("publicKey"); string myPublicKey = Cfg.Get("myPublicKey"); string charset = "UTF-8"; var dic = new Dictionary <string, object>(); dic["channelId"] = "3"; dic["method"] = "loanApplyResultNotify"; //dic["params"] = new { loanId = "20170915174747000008" }; var loanapplyresult = new LoanApplyResult() { LoanId = "2019125514515", Result = 1, Commissions = 10000, Reason = "没有拒绝", LoanAmount = 1000000, LoanTerm = 12, PaymentOption = 1, Orders = new List <ResultOrder>() { new ResultOrder() { SourceOrderId = "12345", LoanAmount = 5000 }, new ResultOrder() { SourceOrderId = "12346", LoanAmount = 5000 } } }; var loantttttstring = JsonConvert.SerializeObject(loanapplyresult); dic["params"] = loantttttstring; dic["signType"] = "RSA2"; dic["ver"] = "1.0"; //dic["statusCode"] = "900"; //dic["errMsg"] = "签名校验失败"; var d = dic.OrderBy(p => p.Key).ToDictionary(p => p.Key, o => o.Value); var text = WebUtils.BuildQuery(d, false, charset); //要组装成一个对象? JObject jb = new JObject(); foreach (var key in dic.Keys) { jb.Add(new JProperty(key, dic[key])); } var tt = JsonConvert.SerializeObject(jb); var s = RSAUtil.Sign(text, privateKey, charset); Console.WriteLine($"签名:{s}"); }
public static void Main(string[] args) { Cfg.Init(); Task.Factory.StartNew(Call); var port = Cfg.GetCfg <int>("Port"); CreateWebHostBuilder(args).UseUrls("http://*:" + port + "/").Build().Run(); }
public McpcPackMeta(Cfg cfg) { pack = new Pack() { pack_format = 3, description = cfg.Description }; }
public static async Task Sort(Cfg cfg) { var files = await SplitFile(cfg.SrcFile, cfg.MemorySize, cfg.OutDir); using (Batch <Stream> .New(files)) { await Merge(files, cfg.DestFile); } }
public void VerifyJoinColumnName() { var auditName = TestAssembly + ".Integration.Naming.JoinNamingRefIngEntity_AUD"; var columns = Cfg.GetClassMapping(auditName).GetProperty("Reference_Id").ColumnIterator; Assert.AreEqual(1, columns.Count()); Assert.AreEqual("jnree_column_reference", ((Column)columns.First()).Name); }
public void SetUp() { mCfg = CfgBuilderGenerator.Generate().Build(); mParenthesizedProduction = new ProductionRule( Symbol.Of <Expression>(), new[] { Symbol.Of <SymLParen>(), Symbol.Of <Expression>(), Symbol.Of <SymRParen>() }, mDummyMethodInfo); }
protected override void Configure(Cfg.Configuration configuration) { configuration.Cache(x => { x.Provider<HashtableCacheProvider>(); x.UseQueryCache = true; }); }
private void init() { Cfg cfg = cfgBll.get(1); App.localStorage.cfg = cfg; FullScreen(); initLayout(); }
protected override void AddMappings(Cfg.Configuration configuration) { // Set some properties that must be set before the mappings are added. // (The overridable Configure(cfg) is called AFTER AddMappings(cfg).) configuration.SetProperty(Cfg.Environment.PreferPooledValuesLo, _preferLo.ToString().ToLower()); base.AddMappings(configuration); }
public string BuildEntityLink(Type entityType, object pkValue) { var hql = string.Format("from {0} x where x.{1} = '{2}'", Cfg.GetClassMapping(entityType).EntityName, GetPkGetter(entityType).PropertyName, pkValue); var url = string.Format("{0}?q={1}", RawUrl.Split('?')[0], HttpUtility.UrlEncode(hql)); var text = string.Format("{0}#{1}", entityType.Name, pkValue); return(UrlHelper.Link(url, text)); }
/* * 初始化页面数据 */ private void initData() { Cfg cfg = cfgBll.get(1); screenWidth.Text = cfg.screenWidth.ToString(); screenHeight.Text = cfg.screenHeight.ToString(); isAutoStartup.IsChecked = getIsAutoStartup("ShowBox"); }
public async Task Scanner_parallel_calls() { var addr = Address.Ptr32(0); var m = new Assembler(addr); m.Branch(3, "fork1"); m.Call("subroutine1"); m.Jmp("join1"); m.Label("fork1"); m.Call("subroutine2"); m.Label("join1"); m.Ret(); m.Label("subroutine2"); m.Ret(); m.Label("subroutine1"); m.Ret(); Cfg cfg = await ScanProgramAsync(addr, m); var sExp = #region Expected @"proc fn00000000 l00000000: // size: 3 bra 00000009 // succ: DirectJump: 00000000 -> 00000003 DirectJump: 00000000 -> 00000009 l00000003: // size: 3 call 0000000E // succ: Call: 00000003 -> 0000000E FallThrough: 00000003 -> 00000006 l00000006: // size: 3 jmp 0000000C // succ: DirectJump: 00000006 -> 0000000C l00000009: // size: 3 call 0000000D // succ: Call: 00000009 -> 0000000D FallThrough: 00000009 -> 0000000C l0000000C: // size: 1 ret proc fn0000000D l0000000D: // size: 1 ret proc fn0000000E l0000000E: // size: 1 ret "; #endregion AssertCfg(sExp, cfg); }
public static Provider DalProviderToProvider(DalProvider dalProvider) { Provider provider = new Provider(); Mapper.Initialize(Cfg => Cfg.CreateMap <DalProvider, Provider>() .ForMember("ItemFromProviders", opt => new List <ItemFromProvider>())); provider = Mapper.Map <DalProvider, Provider>(dalProvider); return(provider); }
private void addMappings() { var ass = Assembly.Load(TestAssembly); foreach (var mapping in Mappings) { Cfg.AddResource(TestAssembly + "." + mapping, ass); } }
private void InitIds() { var i = 1; foreach (var v in Cfg.Variables.Concat(Cfg.GetNonVariableSymbols())) { v.UnqiueId = i++; } }
public void VerifyMapping() { var auditName = TestAssembly + ".Integration.Versioning.OptimisticLockEntity_AUD"; foreach (var property in Cfg.GetClassMapping(auditName).PropertyIterator) { Assert.AreNotEqual("Version", property.Name); } }
public void ShouldNotStoreVersionNumber() { var pc = Cfg.GetClassMapping(typeof(UnversionedOptimisticLockingFieldEntity).FullName + "_AUD"); foreach (var property in pc.PropertyIterator) { property.Name.Should().Not.Be.EqualTo("OptLocking"); } }
public Column GetTableIDColumn(Type type) { PersistentClass pclass; //Obtencion de la información de mapeo pclass = Cfg.GetClassMapping(type); return((Column)((IList)(pclass.Identifier.ColumnIterator))[0]); }
private double getFrequent() { if (frequent == -1) { frequent = Cfg.GetDouble("frequent", 2); } //LogU.d("ClientSession - frequent:" + frequent); return(frequent); }
protected void Application_Start() { AutoMapper.Mapper.Initialize(Cfg => Cfg.AddProfile <MapperProfile>()); AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); }
public void VerifyAuditTableColumnsForNotAuditedEntity() { var table = Cfg.GetClassMapping(TestAssembly + ".Entities.Components.UniquePropsNotAuditedEntity_AUD").Table; table.GetColumn(new Column("Data1")) .Should().Not.Be.Null(); table.GetColumn(new Column("Data2")) .Should().Be.Null(); }
/* #region Encode & Decode * public override CfgEncoder Encode() => this.EncodeUnrecognized() * .Add_Reference("d", diffuse) * .Add_Reference("h", heightMap) * .Add_Reference("bump", normalMap) * .Add_Reference("g", gloss) * .Add_Reference("r", reflectivity) * .Add_Reference("ao", ambient) * .Add_Reference("lp", lastProduct) * .Add("tw", width) * .Add("th", height) * .Add_Bool("col", isColor) * .Add_String("n", name) * .Add("sp", selectedProfile); * * public override bool Decode(string tg, string data) * { * switch (tg) * { * case "d": data.Decode_Reference(ref diffuse); break; * case "h": data.Decode_Reference(ref heightMap); break; * case "bump": data.Decode_Reference(ref normalMap); break; * case "g": data.Decode_Reference(ref gloss); break; * case "r": data.Decode_Reference(ref reflectivity); break; * case "ao": data.Decode_Reference(ref ambient); break; * case "lp": data.Decode_Reference(ref lastProduct); break; * case "tw": width = data.ToInt(); break; * case "th": height = data.ToInt(); break; * case "col": isColor = data.ToBool(); break; * case "n": name = data; break; * case "sp": selectedProfile = data.ToInt(); break; * default: return false; * } * return true; * } #endregion */ #region Inspect public bool Inspect() { var changed = false; var id = InspectedImageMeta; if (InspectedPainter && id != null) { "Editing:".write(40); pegi.write(id.texture2D); pegi.nl(); } "Diffuse".edit("Texture that contains Color of your object. Usually used in _MainTex field.", 70, ref diffuse).nl(ref changed); "Height".edit("Greyscale Texture which represents displacement of your surface. Can be used for parallax effect" + "or height based terrain blending.", 70, ref heightMap).nl(ref changed); "Normal".edit("Normal map - a pinkish texture which modifies normal vector, adding a sense of relief. Normal can also be " + "generated from Height", 70, ref normalMap).nl(ref changed); "Gloss".edit("How smooth the surface is. Polished metal - is very smooth, while rubber is usually not.", 70, ref gloss).nl(ref changed); "Reflectivity".edit("Best used to add a feel of wear to the surface. Reflectivity blocks some of the incoming light.", 70, ref reflectivity).nl(ref changed); "Ambient".edit("Ambient is an approximation of how much light will fail to reach a given segment due to it's indentation in the surface. " + "Ambient map may look a bit similar to height map in some cases, but will more clearly outline shapes on the surface.", 70, ref ambient).nl(ref changed); "Last Result".edit("Whatever you produce, will be stored here, also it can be reused.", 70, ref lastProduct).nl(ref changed); if (!InspectedPainter) { var firstTex = GetAnyTexture(); "width:".edit(ref width).nl(ref changed); "height".edit(ref height).nl(ref changed); if (firstTex && "Match Source".Click().nl(ref changed)) { width = firstTex.width; height = firstTex.height; } "is Color".toggle(ref isColor).nl(ref changed); } pegi.select_Index(ref selectedProfile, Cfg.texturePackagingSolutions); if (icon.Add.Click("New Texture Packaging Profile").nl()) { QcUtils.AddWithUniqueNameAndIndex(Cfg.texturePackagingSolutions); selectedProfile = Cfg.texturePackagingSolutions.Count - 1; Cfg.SetToDirty(); } if ((selectedProfile < Cfg.texturePackagingSolutions.Count)) { if (Cfg.texturePackagingSolutions[selectedProfile].Inspect(this).nl(ref changed)) { Cfg.SetToDirty(); } } return(changed); }
public MainUpdateForm() { InitializeComponent(); m_Cfg = Cfg.ReadConfig(); if (m_Cfg == null) { this.Close(); } m_Files = new UFiles(); }
protected override void Configure(Cfg.Configuration configuration) { configuration.AddProperties(new Dictionary<string, string> { { Cfg.Environment.QueryTranslator, typeof (NHibernate.Hql.Classic.ClassicQueryTranslatorFactory).FullName } } ); }
protected override void Configure(Cfg.Configuration configuration) { var assembly = GetType().Assembly; string mappingNamespace = GetType().Namespace; foreach (var resource in assembly.GetManifestResourceNames()) { if (resource.StartsWith(mappingNamespace) && resource.EndsWith(".hbm.xml")) { configuration.AddResource(resource, assembly); } } }
public static AuditConfiguration getFor(Cfg.Configuration cfg) { AuditConfiguration verCfg = null; if(cfgs.Keys.Contains(cfg)) verCfg = cfgs[cfg]; else{ verCfg = new AuditConfiguration(cfg); cfgs.Add(cfg, verCfg); cfg.BuildMappings(); } return verCfg; }
private static void SetupFirebird(Cfg.Configuration cfg) { try { if (File.Exists("NHibernate.fdb")) File.Delete("NHibernate.fdb"); } catch (Exception e) { Console.WriteLine(e); } FbConnection.CreateDatabase("Database=NHibernate.fdb;ServerType=1"); }
private static void Load() { if (File.Exists(configName)) { StreamReader sr = new StreamReader(configName); cfg = (Cfg)jsonSerializer.Deserialize(sr, typeof(Cfg)); sr.Close(); } else { cfg = new Cfg(); Save(); } }
public void Config(IPersistenceUnitCfg puCfg, Cfg.Configuration configuration) { if(puCfg.Name == MockPersistenceUnitCfg.MockPUName ) { configuration.SetProperty("connection.provider", "NHibernate.Connection.DriverConnectionProvider"); configuration.SetProperty("connection.driver_class", "NHibernate.Driver.SqlClientDriver"); configuration.SetProperty("connection.connection_string", "Server=(local);initial catalog=NHibernateBurrow;Integrated Security=SSPI"); configuration.SetProperty("dialect", "NHibernate.Dialect.MsSql2005Dialect"); configuration.SetProperty("adonet.batch_size", testAdoBatchSize.ToString()); } }
protected override void Configure(Cfg.Configuration configuration) { foreach (var cls in configuration.ClassMappings) { foreach (var prop in cls.PropertyIterator) { foreach (var col in prop.ColumnIterator) { if (col is Column) { var column = col as Column; if (column.SqlType == "nvarchar(max)") column.SqlType = Dialect.GetLongestTypeName(DbType.String); } } } } }
private static void SetupNpgsql(Cfg.Configuration cfg) { var connStr = cfg.Properties[Cfg.Environment.ConnectionString]; using (var conn = new NpgsqlConnection(connStr.Replace("Database=nhibernate", "Database=postgres"))) { conn.Open(); using (var cmd = conn.CreateCommand()) { cmd.CommandText = "drop database nhibernate"; try { cmd.ExecuteNonQuery(); } catch (Exception e) { Console.WriteLine(e); } cmd.CommandText = "create database nhibernate"; cmd.ExecuteNonQuery(); } } // Install the GUID generator function that uses the most common "random" algorithm. using (var conn = new NpgsqlConnection(connStr)) { conn.Open(); using (var cmd = conn.CreateCommand()) { cmd.CommandText = @"CREATE OR REPLACE FUNCTION uuid_generate_v4() RETURNS uuid AS '$libdir/uuid-ossp', 'uuid_generate_v4' VOLATILE STRICT LANGUAGE C;"; cmd.ExecuteNonQuery(); } } }
public static void CreateConfig() { try { using (var stream = new FileStream(filepath, FileMode.Create, FileAccess.Write, FileShare.Write)) { using (var sr = new StreamWriter(stream)) { config = new Cfg(); var obj = JsonConvert.SerializeObject(config, Formatting.Indented); sr.Write(obj); } } Log.ConsoleInfo("Created AutoRank.json."); } catch (Exception ex) { Log.ConsoleError(ex.Message); config = new Cfg(); } }
public AuditMetadataGenerator(Cfg.Configuration cfg, GlobalConfiguration globalCfg, AuditEntitiesConfiguration verEntCfg, IAuditStrategy auditStrategy, XmlElement revisionInfoRelationMapping, AuditEntityNameRegister auditEntityNameRegister) { Cfg = cfg; GlobalCfg = globalCfg; VerEntCfg = verEntCfg; AuditStrategy = auditStrategy; this.revisionInfoRelationMapping = revisionInfoRelationMapping; BasicMetadataGenerator = new BasicMetadataGenerator(); componentMetadataGenerator = new ComponentMetadataGenerator(this); idMetadataGenerator = new IdMetadataGenerator(this); toOneRelationMetadataGenerator = new ToOneRelationMetadataGenerator(this); AuditEntityNameRegister = auditEntityNameRegister; EntitiesConfigurations = new Dictionary<string, EntityConfiguration>(); NotAuditedEntitiesConfigurations = new Dictionary<string, EntityConfiguration>(); entitiesJoins = new Dictionary<string, IDictionary<Join, XmlElement>>(); }
public AuditMetadataGenerator(Cfg.Configuration cfg, GlobalConfiguration globalCfg, AuditEntitiesConfiguration verEntCfg, XmlElement revisionInfoRelationMapping, AuditEntityNameRegister auditEntityNameRegister, ClassesAuditingData classesAuditingData) { this.Cfg = cfg; this.GlobalCfg = globalCfg; this.VerEntCfg = verEntCfg; this.revisionInfoRelationMapping = revisionInfoRelationMapping; this.BasicMetadataGenerator = new BasicMetadataGenerator(); this.componentMetadataGenerator = new ComponentMetadataGenerator(this); this.idMetadataGenerator = new IdMetadataGenerator(this); this.toOneRelationMetadataGenerator = new ToOneRelationMetadataGenerator(this); this.AuditEntityNameRegister = auditEntityNameRegister; this.ClassesAuditingData = classesAuditingData; EntitiesConfigurations = new Dictionary<String, EntityConfiguration>(); NotAuditedEntitiesConfigurations = new Dictionary<String, EntityConfiguration>(); entitiesJoins = new Dictionary<String, IDictionary<Join, XmlElement>>(); }
protected override void AddMappings(Cfg.Configuration configuration) { configuration.AddDeserializedMapping(GetMappings(), "TestDomain"); }
private static void SetupMySql(Cfg.Configuration obj) { //TODO: do nothing }
private static void SetupOracle(Cfg.Configuration cfg) { // disabled until system password is set on TeamCity //var connStr = // cfg.Properties[Cfg.Environment.ConnectionString] // .Replace("User ID=nhibernate", "User ID=SYSTEM") // .Replace("Password=nhibernate", "Password=password"); //cfg.DataBaseIntegration(db => // { // db.ConnectionString = connStr; // db.Dialect<NHibernate.Dialect.Oracle10gDialect>(); // db.KeywordsAutoImport = Hbm2DDLKeyWords.None; // }); //using (var sf = cfg.BuildSessionFactory()) //{ // try // { // using(var s = sf.OpenSession()) // s.CreateSQLQuery("drop user nhibernate cascade").ExecuteUpdate(); // } // catch {} // using (var s = sf.OpenSession()) // { // s.CreateSQLQuery("create user nhibernate identified by nhibernate").ExecuteUpdate(); // s.CreateSQLQuery("grant dba to nhibernate with admin option").ExecuteUpdate(); // } //} }
private static void SetupSQLite(Cfg.Configuration cfg) { if (File.Exists("NHibernate.db")) File.Delete("NHibernate.db"); }
private static void SetupSqlServerCe(Cfg.Configuration cfg) { try { if (File.Exists("NHibernate.sdf")) File.Delete("NHibernate.sdf"); } catch (Exception e) { Console.WriteLine(e); } using (var en = new SqlCeEngine("DataSource=\"NHibernate.sdf\"")) { en.CreateDatabase(); } }
protected override void Configure(Cfg.Configuration configuration) { configuration.SetProperty(Cfg.Environment.GenerateStatistics, "true"); }
protected override void Configure(Cfg.Configuration configuration) { configuration.SetProperty(Cfg.Environment.ShowSql, "true"); base.Configure(configuration); }
protected override void Configure(Cfg.Configuration configuration) { base.Configure(configuration); configuration.SetProperty("linqtohql.generatorsregistry", "NHibernate.Test.NHSpecificTest.NH2318.ExtendedLinqtoHqlGeneratorsRegistry, NHibernate.Test"); }
protected override void Configure(Cfg.Configuration configuration) { configuration.DataBaseIntegration(x=> x.LogFormattedSql = false); }
public virtual void Initialize(Cfg.Configuration cfg) { VerCfg = AuditConfiguration.GetFor(cfg); }
protected override void AddMappings(Cfg.Configuration configuration) { var mapper = new ModelMapper(); mapper.Class<Employee>(mc => { mc.Id(x => x.Id, map => { map.Generator(Generators.Increment); map.Column("Id"); }); mc.ManyToOne<EmployeeInfo>(x => x.Info, map => { // Columns have to be declared first otherwise other properties are reset. map.Columns(x => { x.Name("COMP_ID"); }, x => { x.Name("PERS_ID"); }); map.Unique(true); map.Cascade(Mapping.ByCode.Cascade.All | Mapping.ByCode.Cascade.DeleteOrphans); map.NotFound(NotFoundMode.Exception); }); mc.Property(x => x.Name); }); mapper.Class<EmployeeInfo>(mc => { mc.ComponentAsId<EmployeeInfo.Identifier>(x => x.Id, map => { map.Property(x => x.CompanyId, m => m.Column("COMPS_ID")); map.Property(x => x.PersonId, m => m.Column("PERS_ID")); }); }); configuration.AddMapping(mapper.CompileMappingForAllExplicitlyAddedEntities()); }
public void UpdateSchema( bool script, bool update, Cfg.Configuration configuration) { SchemaUpdate su = new SchemaUpdate(configuration); su.Execute(script, update); }