本文整理汇总了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 = "室内模式";
//.........这里部分代码省略.........
示例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);
}
}
}
示例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);
}
}
}