protected static void InitMapper() { ConfigureHandler handler = new ConfigureHandler(Configure); DomSqlMapBuilder builder = new DomSqlMapBuilder(); _mapper = builder.ConfigureAndWatch(handler); }
public void ConfigurationWatcherTestOnMappingFile() { string fileName = @"..\..\Maps\MSSQL\SqlClient\Account.xml"; ConfigureHandler handler = new ConfigureHandler(MyHandler); DomSqlMapBuilder builder = new DomSqlMapBuilder(); NameValueCollection properties = new NameValueCollection(); properties.Add("collection2Namespace", "IBatisNet.DataMapper.Test.Domain.LineItemCollection, IBatisNet.DataMapper.Test"); properties.Add("nullableInt", "int"); builder.Properties = properties; ISqlMapper mapper = builder.ConfigureAndWatch(_fileName, handler); // test that the mapper was correct build Assert.IsNotNull(mapper); FileInfo fi = Resources.GetFileInfo(fileName); fi.LastWriteTime = DateTime.Now; fi.Refresh(); // Let's give a small bit of time for the change to propagate. // The ConfigWatcherHandler class has a timer which // waits for 500 Millis before delivering // the event notification. System.Threading.Thread.Sleep(600); Assert.IsTrue(_hasChanged); _hasChanged = false; }
/// <summary> /// Initialize an sqlMap /// </summary> protected static void InitSqlMap() { //DateTime start = DateTime.Now; ConfigureHandler handler = new ConfigureHandler( Configure ); DomSqlMapBuilder builder = new DomSqlMapBuilder(); #if dotnet2 sqlMap = builder.ConfigureAndWatch("sqlmap" + "_" + ConfigurationManager.AppSettings["database"] + "_" + ConfigurationManager.AppSettings["providerType"] + ".config", handler); #else sqlMap = builder.ConfigureAndWatch( "sqlmap"+ "_" + ConfigurationSettings.AppSettings["database"] + "_" + ConfigurationSettings.AppSettings["providerType"] +".config", handler ); #endif //string loadTime = DateTime.Now.Subtract(start).ToString(); //Console.WriteLine("Loading configuration time :"+loadTime); }
protected static void InitMapper() { ConfigureHandler handler = new ConfigureHandler(Configure); DomSqlMapBuilder builder = new DomSqlMapBuilder(); /* XmlDocument sqlMapConfig = Resources.GetEmbeddedResourceAsXmlDocument("MamShare.Persistence.Config.SqlMap.config, MamShare.Persistence"); _mapper = builder.Configure(sqlMapConfig); */ _mapper = builder.ConfigureAndWatch("SqlMap.config",handler); }
/// <summary> /// Init the 'default' SqlMapper defined by the SqlMap.Config file. /// </summary> protected static void InitMapper() { ConfigureHandler handler = new ConfigureHandler(Configure); DomSqlMapBuilder builder = new DomSqlMapBuilder(); string resourceDirectory = ConfigurationManager.AppSettings.Get("sqlmapconfig"); string resource = InitMapXML(resourceDirectory); InitMapXML(resourceDirectory); ISqlMapper sqlmapper = builder.ConfigureAndWatch(resource, handler); _Mapper = sqlmapper; }
/// <summary> /// Init the 'default' SqlMapper defined by the SqlMap.Config file. /// </summary> public static void InitMapper() { ConfigureHandler handler = new ConfigureHandler(Configure); DomSqlMapBuilder builder = new DomSqlMapBuilder(); _mapper = builder.ConfigureAndWatch("NurDocMapper.config", handler); }
public void TestConfigureAndWatchRelativePathViaBuilder() { ConfigureHandler handler = new ConfigureHandler(Configure); DomSqlMapBuilder builder = new DomSqlMapBuilder(); NameValueCollection properties = new NameValueCollection(); properties.Add("collection2Namespace", "IBatisNet.DataMapper.Test.Domain.LineItemCollection, IBatisNet.DataMapper.Test"); properties.Add("nullableInt", "int"); builder.Properties = properties; ISqlMapper mapper = builder.ConfigureAndWatch(_fileName, handler); Assert.IsNotNull(mapper); }
public void TestConfigureAndWatchAbsolutePathWithFileSuffixViaBuilder() { _fileName = "file://"+Resources.BaseDirectory+Path.DirectorySeparatorChar+_fileName; ConfigureHandler handler = new ConfigureHandler(Configure); DomSqlMapBuilder builder = new DomSqlMapBuilder(); NameValueCollection properties = new NameValueCollection(); properties.Add("collection2Namespace", "IBatisNet.DataMapper.Test.Domain.LineItemCollection, IBatisNet.DataMapper.Test"); properties.Add("nullableInt", "int"); builder.Properties = properties; ISqlMapper mapper = builder.ConfigureAndWatch(_fileName, handler); Assert.IsNotNull(mapper); }