Exemplo n.º 1
0
        protected static void InitMapper()
        {
            ConfigureHandler handler = new ConfigureHandler(Configure);
            DomSqlMapBuilder builder = new DomSqlMapBuilder();

            _mapper = builder.ConfigureAndWatch(handler);
        }
Exemplo n.º 2
0
        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;
        }
Exemplo n.º 3
0
		/// <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);
		}
Exemplo n.º 4
0
 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);
 }
Exemplo n.º 5
0
        /// <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;
        }
Exemplo n.º 6
0
 /// <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);
 }
Exemplo n.º 7
0
        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);
        }
Exemplo n.º 8
0
        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);
        }