当前位置: 首页>>代码示例>>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;未经允许,请勿转载。