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


C# UnitOfWork.Connect方法代码示例

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


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

示例1: Main

 static void Main(string[] args)
 {
     Console.WriteLine("Starting...");
     using(UnitOfWork uow = new UnitOfWork()) {
         Console.WriteLine("Connecting...");
         uow.ConnectionString = Constants.DatabaseConnectionString;
         uow.Connect();
         foreach(Person p in new XPCollection<Person>(uow)) {
             Console.WriteLine("Person - FirstName: {0}, LastName: {1}", p.FirstName, p.LastName);
             foreach(Product product in p.Products) {
                 Console.WriteLine("  Product - Name: {0}, Manager: {1}", product.Name, product.Manager.FirstName + " " + product.Manager.LastName);
             }
         }
     }
     Console.WriteLine("Press Enter to close...");
     Console.ReadLine();
 }
开发者ID:IgnatovDan,项目名称:XPO-Deployment,代码行数:17,代码来源:Program_DirectDBConnect_Console.cs

示例2: LegacyDbExists

 bool LegacyDbExists(UnitOfWork unitOfWork) {
     try {
         unitOfWork.Connect();
         return true;
     } catch (UnableToOpenDatabaseException) {
         DevExpress.XtraEditors.XtraMessageBox.Show(
             "Application will now exit because you have not created the legacy database!!!", "Exit", MessageBoxButtons.OK,
             MessageBoxIcon.Error);
         Application.ExitThread();
     }
     return false;
 }
开发者ID:dimajanzen,项目名称:eXpand,代码行数:12,代码来源:Updater.cs

示例3: ConnectToLegacyVideoRentDB

 UnitOfWork ConnectToLegacyVideoRentDB() {
     var unitOfWork = new UnitOfWork {
         ConnectionString = ConfigurationManager.ConnectionStrings["VideoRentLegacy"].ConnectionString,
         AutoCreateOption = AutoCreateOption.None
     };
     try {
         unitOfWork.Connect();
     } catch (UnableToOpenDatabaseException) {
         if (StartVideoRent(unitOfWork))
             unitOfWork.Connect();
         else
             Application.ExitThread();
     }
     return unitOfWork;
 }
开发者ID:dimajanzen,项目名称:eXpand,代码行数:15,代码来源:Updater.cs

示例4: ConnectToLegacyVideoRentDB

 UnitOfWork ConnectToLegacyVideoRentDB() {
     _updater.SaveResource("LegacyVideoRent.zip");
     Decompress(new FileInfo("LegacyVideoRent.zip"));
     var unitOfWork = new UnitOfWork {
         ConnectionString = ConfigurationManager.ConnectionStrings["VideoRentLegacy"].ConnectionString,
         AutoCreateOption = AutoCreateOption.None
     };
     unitOfWork.Connect();
     return unitOfWork;
 }
开发者ID:aries544,项目名称:eXpand,代码行数:10,代码来源:Updater.cs


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