当前位置: 首页>>代码示例>>C#>>正文


C# Session.UpdateSchema方法代码示例

本文整理汇总了C#中Session.UpdateSchema方法的典型用法代码示例。如果您正苦于以下问题:C# Session.UpdateSchema方法的具体用法?C# Session.UpdateSchema怎么用?C# Session.UpdateSchema使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Session的用法示例。


在下文中一共展示了Session.UpdateSchema方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        static void Main(string[] argv)
        {
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
            Application.ThreadException += Application_ThreadException;

            #if !DEBUG
            //if (!Util.VerifyKey())
            //{
            //    using (var form = new RegisterForm())
            //    {
            //        DialogResult res = form.ShowDialog();
            //        if (res == DialogResult.OK)
            //            Application.Restart();
            //    }

            //    return;
            //}
            #endif
            try
            {
                DevExpress.UserSkins.OfficeSkins.Register();
                DevExpress.UserSkins.BonusSkins.Register();
                DevExpress.Skins.SkinManager.EnableFormSkins();

                DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle("Devexpress Style");

                int count = 0;
                IDataStore dataStore = null;
            RETRY:
                try
                {
                    dataStore = XpoDefault.GetConnectionProvider(
                        MSSqlConnectionProvider.GetConnectionString(Properties.Settings.Default.SqlInstanceName, "FaceCapture"),
                        AutoCreateOption.DatabaseAndSchema);

                }
                catch (Exception ex)
                {
                    ++count;
                    if (count == 3)
                    {
                        MessageBox.Show("无法连接数据库,请确认数据库已经正确安装。", "数据库", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    else
                    {
                        //让sqlserver有时间启动。
                        System.Threading.Thread.Sleep(3000);
                        goto RETRY;
                    }
                }

                using (SimpleDataLayer dataLayer = new SimpleDataLayer(dataStore))
                {
                    using (Session session = new Session(dataLayer))
                    {
                        session.UpdateSchema();
                        session.CreateObjectTypeRecords(
                            typeof(Damany.PortraitCapturer.DAL.DTO.CapturedImageObject),
                            typeof(Damany.PortraitCapturer.DAL.DTO.Video),
                            typeof(Damany.PortraitCapturer.DAL.DTO.Portrait),
                            typeof(Damany.PortraitCapturer.DAL.DTO.Frame),
                            typeof(Damany.PortraitCapturer.DAL.DTO.TargetPerson));
                        var cachNode = new DataCacheNode(new DataCacheRoot(dataStore));
                        XpoDefault.DataLayer = new ThreadSafeDataLayer(session.Dictionary, cachNode);
                    }
                }

                try
                {

            #if !DEBUG
                    //if (!Util.VerifyKey())
                    //{
                    //    RegisterForm form = new RegisterForm();
                    //    DialogResult res = form.ShowDialog();
                    //    if (res == DialogResult.OK)
                    //    {
                    //        Application.Restart();
                    //    }

                    //    return;
                    //}
            #endif

                    var modeCollection = new DevExpress.Xpo.XPCollection<WorkModeCamSetting>();
                    modeCollection.Load();

                    if (modeCollection.Count == 0)
                    {
                        var workingModeSettings = new WorkModeCamSetting();
                        workingModeSettings.ModeName = "室外模式";
                        workingModeSettings.ShutterSpeed = 3;
                        workingModeSettings.IrisLevel = 40;
                        workingModeSettings.Save();

                        workingModeSettings = new WorkModeCamSetting();
                        workingModeSettings.ShutterSpeed = 1;
                        workingModeSettings.IrisLevel = 50;
                        workingModeSettings.ModeName = "室内模式";
//.........这里部分代码省略.........
开发者ID:dalinhuang,项目名称:appcollection,代码行数:101,代码来源:Program.cs

示例2: UpdateDatabase

 static void UpdateDatabase()
 {
     using (IDataLayer dal = XpoDefault.GetDataLayer(ConfigurationManager.ConnectionStrings[ConnectionString].ConnectionString,AutoCreateOption.DatabaseAndSchema))
     {
         using(Session session = new Session(dal))
         {
             Assembly asm = Assembly.GetExecutingAssembly();
             session.UpdateSchema(asm);
             session.CreateObjectTypeRecords(asm);
         }
     }
 }
开发者ID:ezimaxtechnologies,项目名称:eZiMAX,代码行数:12,代码来源:XpoHelper.cs

示例3: UpdateDatabase

 static void UpdateDatabase()
 {
     using (IDataLayer dal = XpoDefault.GetDataLayer(ConfigurationManager.ConnectionStrings[ConnectionStringName].ConnectionString,
         AutoCreateOption.DatabaseAndSchema))
     {
         using (Session session = new Session(dal))
         {
             Assembly asm = Assembly.GetExecutingAssembly();
             session.UpdateSchema(Assembly.Load("FarmerInfo"));
             //session.UpdateSchema(Assembly.Load("vCloud.Survey.Model.SurveyAdminInfo"));
             //session.UpdateSchema(Assembly.Load("vCloud.Survey.Model.Log"));
             //session.UpdateSchema(typeof(Code).Assembly, typeof(MemberInformation).Assembly, typeof(Account).Assembly);
             session.CreateObjectTypeRecords(asm);
         }
     }
 }
开发者ID:fenyiwudian,项目名称:farmer,代码行数:16,代码来源:DBManage.cs


注:本文中的Session.UpdateSchema方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。