當前位置: 首頁>>代碼示例>>C#>>正文


C# Configuration.AddDirectory方法代碼示例

本文整理匯總了C#中NHibernate.Cfg.Configuration.AddDirectory方法的典型用法代碼示例。如果您正苦於以下問題:C# Configuration.AddDirectory方法的具體用法?C# Configuration.AddDirectory怎麽用?C# Configuration.AddDirectory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在NHibernate.Cfg.Configuration的用法示例。


在下文中一共展示了Configuration.AddDirectory方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: NHibernateManager

        static NHibernateManager()
        {
            Configuration cfg= new Configuration().Configure();
                //cfg.AddAssembly("App_SubCode_APAS");
                //cfg.AddClass(typeof(Apas.Business.BCOtherFeeType));

                //Business Persistent Entity Mappings
                cfg.AddDirectory(new System.IO.DirectoryInfo
                      (
                            HttpContext.Current.Server.MapPath
                            (
                                @"~/App_Code/APAS/Business/NHibernate Mappings/"
                             )
                         )
                    );

                //Security Layer Entity Mappings
                cfg.AddDirectory(new System.IO.DirectoryInfo
                    (
                        HttpContext.Current.Server.MapPath
                        (
                            @"~/App_Code/APAS/Security/NHibernate Mappings/"
                         )
                     )
                );

                sessionFactory= cfg.BuildSessionFactory();
        }
開發者ID:khtutz,項目名稱:anet4jkhz,代碼行數:28,代碼來源:NHibernateManager.cs

示例2: Main

        static void Main()
        {
            DbConnectionStringBuilder dcsBuilder = new DbConnectionStringBuilder();
            dcsBuilder.Add("User ID", "wjzgis");
            dcsBuilder.Add("Password", "wjzgis");
            dcsBuilder.Add("Service Name", "sunz");
            dcsBuilder.Add("Host", "172.16.1.9");
            dcsBuilder.Add("Integrated Security", false);
            string licPath = Application.StartupPath + "\\DDTek.lic";
            //dcsBuilder.Add("License Path", licPath);
            //若路徑中存在空格,則會在路徑名稱前加上"\""
            string conStr = dcsBuilder.ConnectionString;
            conStr = conStr.Replace("\"", "");

            Configuration config = new Configuration();
            config.AddDirectory(new System.IO.DirectoryInfo( System.IO.Path.Combine(Application.StartupPath, "DataMapping")));

            config.Properties["connection.connection_string"] = conStr;

            NHibernate.ISessionFactory sFactory = config.BuildSessionFactory();
            NHibernate.ISession session = sFactory.OpenSession();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
開發者ID:hy1314200,項目名稱:HyDM,代碼行數:26,代碼來源:Program.cs

示例3: init

    public void init()
    {
        cfg = new Configuration();
        cfg.Configure();

        /* Add xml mappings created manually
         * - Because Web Site projects are only compiled during runtime, the hibernate mapping files will need to
         * be discovered and added to the assembly at runtime.
         */
        cfg.AddDirectory(new DirectoryInfo(HttpContext.Current.Server.MapPath("~/Mapping")));

        //Add your custom configurations here to override the Hibernate.xml configuration.
    }
開發者ID:hareluya86,項目名稱:ProjectPortal,代碼行數:13,代碼來源:Hibernate.cs

示例4: InitHibernate

        public static void InitHibernate()
        {
            Debug.WriteLine("Configuring Hibernate...");
            Log.Info("hello");
            var cfg = new Configuration();

            HbmSerializer.Default.Validate = true;

            HbmSerializer.Default.Serialize(Environment.CurrentDirectory, Assembly.GetExecutingAssembly());
            cfg.AddDirectory(new DirectoryInfo(Environment.CurrentDirectory));

            var sessionFactory = cfg.Configure().BuildSessionFactory();
            SessionFactory = sessionFactory;
            Debug.WriteLine("Created SessionFactory!");
        }
開發者ID:igeorge1982,項目名稱:NHibernate,代碼行數:15,代碼來源:HibernateConfig.cs

示例5: OpenSession

        /// <summary> 
        /// Method to create session and manage entities 
        /// </summary> 
        /// <returns></returns> 
        ISession OpenSession()
        {
            if (sessionFactory == null)
            {
                var cgf = new Configuration();


                var data = cgf.Configure("c:\\users\\matute\\documents\\visual studio 2015\\Projects\\NHibernate_Expo\\NHibernate_Expo\\Models\\NHibernate\\Configuration\\hibernate.cfg.xml");
                cgf.AddDirectory(new System.IO.DirectoryInfo("c:\\users\\matute\\documents\\visual studio 2015\\Projects\\NHibernate_Expo\\NHibernate_Expo\\Models\\NHibernate\\Mappings"));
            
                //var data = cgf.Configure(HttpContext.Current.Server.MapPath(@"Models\NHibernate\Configuration\hibernate.cfg.xml"));
                //cgf.AddDirectory(new System.IO.DirectoryInfo(HttpContext.Current.Server.MapPath(@"Models\NHibernate\Mappings")));

                sessionFactory = data.BuildSessionFactory();
            }
            return sessionFactory.OpenSession();
        }
開發者ID:porrasgeorge,項目名稱:ExpoWeb,代碼行數:21,代碼來源:EmployeeInfoDAL.cs

示例6: CreateProvider

        public override DomainServiceDescriptionProvider CreateProvider(Type domainServiceType, DomainServiceDescriptionProvider parent)
        {
            string currentDir = AppDomain.CurrentDomain.BaseDirectory;
            Configuration cfg = null;
            try
            {
                cfg = new Configuration();
                cfg.Configure(_nHibernateConfigurationPath);
                cfg.AddDirectory(new DirectoryInfo(currentDir));
            }
            catch
            {
                throw;
            }

            return new NHibernateTypeDescriptionProvider(domainServiceType, parent, cfg);
        }
開發者ID:OpenRIAServices,項目名稱:OpenRiaServices,代碼行數:17,代碼來源:NHibernateMetadataProviderAttribute.cs

示例7: Build

        public Configuration Build()
        {
            Configuration cfg = LoadConfigurationFromFile();
            if (cfg == null)
            {

                foreach (TelChina.AF.Sys.Configuration.AddElement item in AFConfigurationManager.PLGroup.Storages)
                {
                    var fileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, item.FileName);
                    cfg = new NHibernate.Cfg.Configuration();
                    cfg.Configure(fileName);

                    //設置實體映射文件關聯
                    var mappingFileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, CONFIGPATH);
                    cfg.AddDirectory(new System.IO.DirectoryInfo(mappingFileName));
                }

                SaveConfigurationToFile(cfg);
            }
            return cfg;
        }
開發者ID:Allen-Zhou,項目名稱:AF,代碼行數:21,代碼來源:ConfigurationBuilder.cs

示例8: OpenSession

        /// <summary>
        /// Method to create session and manage entities
        /// </summary>
        /// <returns></returns>
        ISession OpenSession()
        {
            if (sessionFactory == null)
            {
                var cgf = new Configuration();
                var data = cgf.Configure(HttpContext.Current.Server.MapPath(@"Models\NHibernate\Configuration\hibernate.cfg.xml"));
                cgf.AddDirectory(new System.IO.DirectoryInfo(HttpContext.Current.Server.MapPath(@"Models\NHibernate\Mappings")));
                sessionFactory = data.BuildSessionFactory();
            }

            return sessionFactory.OpenSession();
        }
開發者ID:Rahul007Dev,項目名稱:introducing-nhibernate-mvc,代碼行數:16,代碼來源:ModelClasses.cs


注:本文中的NHibernate.Cfg.Configuration.AddDirectory方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。