├── .gitattributes ├── .github └── workflows │ └── vale.yml ├── .gitignore ├── CS ├── EFCore │ ├── ClassLibrary1 │ │ ├── ClassLibrary1.csproj │ │ ├── ClassLibrary1DbContext.cs │ │ ├── ModuleInfo1.cs │ │ ├── PersistentClass1.cs │ │ └── XafModule1.cs │ ├── ClassLibrary2 │ │ ├── ClassLibrary2.csproj │ │ ├── ClassLibrary2DbContext.cs │ │ ├── PersistentClass2.cs │ │ └── XafModule2.cs │ ├── CommonModule │ │ ├── BusinessObjects │ │ │ ├── ApplicationUser.cs │ │ │ ├── ApplicationUserLoginInfo.cs │ │ │ ├── CommonModuleDbContext.cs │ │ │ └── ReadMe.txt │ │ ├── CommonModule.csproj │ │ ├── Controllers │ │ │ └── ReadMe.txt │ │ ├── DatabaseUpdate │ │ │ ├── ReadMe.txt │ │ │ └── Updater.cs │ │ ├── Images │ │ │ └── ReadMe.txt │ │ ├── Model.DesignedDiffs.xafml │ │ ├── Module.cs │ │ ├── ReadMe.txt │ │ └── Welcome.html │ ├── TwoModelsForDifferentDatabases.Blazor.Server │ │ ├── App.razor │ │ ├── BlazorApplication.cs │ │ ├── BlazorModule.cs │ │ ├── Controllers │ │ │ └── ReadMe.txt │ │ ├── Editors │ │ │ └── ReadMe.txt │ │ ├── Images │ │ │ └── ReadMe.txt │ │ ├── Model.xafml │ │ ├── Pages │ │ │ └── _Host.cshtml │ │ ├── Program.cs │ │ ├── ReadMe.txt │ │ ├── Services │ │ │ ├── CircuitHandlerProxy.cs │ │ │ └── ProxyHubConnectionHandler.cs │ │ ├── Startup.cs │ │ ├── TwoModelsForDifferentDatabases.Blazor.Server.csproj │ │ ├── _Imports.razor │ │ ├── appsettings.Development.json │ │ ├── appsettings.json │ │ └── wwwroot │ │ │ ├── css │ │ │ └── site.css │ │ │ ├── favicon.ico │ │ │ └── images │ │ │ ├── Logo.svg │ │ │ └── SplashScreen.svg │ ├── TwoModelsForDifferentDatabases.Win │ │ ├── App.config │ │ ├── Controllers │ │ │ └── ReadMe.txt │ │ ├── Editors │ │ │ └── ReadMe.txt │ │ ├── ExpressApp.ico │ │ ├── Images │ │ │ ├── ExpressAppLogo.png │ │ │ ├── Logo.svg │ │ │ └── ReadMe.txt │ │ ├── Model.xafml │ │ ├── Program.cs │ │ ├── ReadMe.txt │ │ ├── Startup.cs │ │ ├── TwoModelsForDifferentDatabases.Win.csproj │ │ ├── WinApplication.cs │ │ ├── WinModule.cs │ │ ├── XafSplashScreen.Designer.cs │ │ ├── XafSplashScreen.cs │ │ └── XafSplashScreen.resx │ └── TwoModelsForDifferentDatabases.sln └── XPO │ ├── .NET │ ├── ClassLibrary1 │ │ ├── ClassLibrary1.csproj │ │ ├── PersistentClass1.cs │ │ └── XafModule1.cs │ ├── ClassLibrary2 │ │ ├── ClassLibrary2.csproj │ │ ├── PersistentClass2.cs │ │ └── XafModule2.cs │ ├── CommonModule │ │ ├── BusinessObjects │ │ │ ├── ApplicationUser.cs │ │ │ ├── ApplicationUserLoginInfo.cs │ │ │ └── ReadMe.txt │ │ ├── CommonModule.cs │ │ ├── CommonModule.csproj │ │ ├── Controllers │ │ │ └── ReadMe.txt │ │ ├── DatabaseUpdate │ │ │ ├── ReadMe.txt │ │ │ └── Updater.cs │ │ ├── Images │ │ │ └── ReadMe.txt │ │ ├── Model.DesignedDiffs.xafml │ │ ├── ReadMe.txt │ │ └── Welcome.html │ ├── Readme.md │ ├── TwoXpoModelsForDifferentDatabases.Blazor.Server │ │ ├── App.razor │ │ ├── BlazorApplication.cs │ │ ├── BlazorModule.cs │ │ ├── Controllers │ │ │ └── ReadMe.txt │ │ ├── Editors │ │ │ └── ReadMe.txt │ │ ├── Images │ │ │ └── ReadMe.txt │ │ ├── Model.xafml │ │ ├── Pages │ │ │ └── _Host.cshtml │ │ ├── Program.cs │ │ ├── ReadMe.txt │ │ ├── Services │ │ │ ├── CircuitHandlerProxy.cs │ │ │ └── ProxyHubConnectionHandler.cs │ │ ├── Startup.cs │ │ ├── TwoXpoModelsForDifferentDatabases.Blazor.Server.csproj │ │ ├── _Imports.razor │ │ ├── appsettings.Development.json │ │ ├── appsettings.json │ │ └── wwwroot │ │ │ ├── css │ │ │ └── site.css │ │ │ ├── favicon.ico │ │ │ └── images │ │ │ ├── Logo.svg │ │ │ └── SplashScreen.svg │ ├── TwoXpoModelsForDifferentDatabases.Win │ │ ├── App.config │ │ ├── Controllers │ │ │ └── ReadMe.txt │ │ ├── Editors │ │ │ └── ReadMe.txt │ │ ├── ExpressApp.ico │ │ ├── Images │ │ │ ├── ExpressAppLogo.png │ │ │ ├── Logo.svg │ │ │ └── ReadMe.txt │ │ ├── Model.xafml │ │ ├── Program.cs │ │ ├── ReadMe.txt │ │ ├── Startup.cs │ │ ├── TwoXpoModelsForDifferentDatabases.Win.csproj │ │ ├── WinApplication.cs │ │ ├── WinModule.cs │ │ ├── XafSplashScreen.Designer.cs │ │ ├── XafSplashScreen.cs │ │ └── XafSplashScreen.resx │ └── TwoXpoModelsForDifferentDatabases.sln │ └── .NetFramework │ ├── ClassLibrary1 │ ├── ClassLibrary1.csproj │ ├── ModuleInfo1.cs │ ├── PersistentClass1.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── XafModule1.cs │ ├── ClassLibrary2 │ ├── ClassLibrary2.csproj │ ├── PersistentClass2.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── XafModule2.cs │ ├── CommonModule │ ├── BusinessObjects │ │ ├── ApplicationUser.cs │ │ └── ApplicationUserLoginInfo.cs │ ├── CommonModule.cs │ ├── CommonModule.csproj │ ├── DatabaseUpdate │ │ └── Updater.cs │ └── Properties │ │ └── AssemblyInfo.cs │ ├── Readme.md │ ├── TwoXpoModelsForDifferentDatabases.Web │ ├── .gitignore │ ├── Default.aspx │ ├── Default.aspx.cs │ ├── Default.aspx.designer.cs │ ├── Error.aspx │ ├── Error.aspx.cs │ ├── Error.aspx.designer.cs │ ├── Global.asax │ ├── Global.asax.cs │ ├── Login.aspx │ ├── Login.aspx.cs │ ├── Login.aspx.designer.cs │ ├── Model.xafml │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── ReadMe.txt │ ├── TwoXpoModelsForDifferentDatabases.Web.csproj │ ├── Web.Debug.config │ ├── Web.EasyTest.config │ ├── Web.Release.config │ ├── Web.config │ ├── WebApplication.cs │ └── WebApplication.resx │ ├── TwoXpoModelsForDifferentDatabases.Win │ ├── App.config │ ├── ExpressApp.ico │ ├── Images │ │ └── ReadMe.txt │ ├── Model.xafml │ ├── Program.cs │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings │ ├── ReadMe.txt │ ├── TwoXpoModelsForDifferentDatabases.Win.csproj │ ├── WinApplication.Designer.cs │ ├── WinApplication.cs │ └── WinApplication.resx │ └── TwoXpoModelsForDifferentDatabases.sln ├── LICENSE ├── Readme.md ├── VB ├── ClassLibrary1 │ ├── ClassLibrary1.vbproj │ ├── ModuleInfo1.vb │ ├── PersistentClass1.vb │ ├── Properties │ │ └── AssemblyInfo.vb │ └── XafModule1.vb ├── ClassLibrary2 │ ├── ClassLibrary2.vbproj │ ├── PersistentClass2.vb │ ├── Properties │ │ └── AssemblyInfo.vb │ └── XafModule2.vb ├── CommonModule │ ├── BusinessObjects │ │ ├── ApplicationUser.vb │ │ └── ApplicationUserLoginInfo.vb │ ├── CommonModule.vb │ ├── CommonModule.vbproj │ ├── DatabaseUpdate │ │ └── Updater.vb │ └── Properties │ │ └── AssemblyInfo.vb ├── TwoXpoModelsForDifferentDatabases.Web │ ├── Default.aspx │ ├── Default.aspx.designer.vb │ ├── Default.aspx.vb │ ├── Error.aspx │ ├── Error.aspx.designer.vb │ ├── Error.aspx.vb │ ├── Global.asax │ ├── Global.asax.vb │ ├── Login.aspx │ ├── Login.aspx.designer.vb │ ├── Login.aspx.vb │ ├── Model.xafml │ ├── Properties │ │ └── AssemblyInfo.vb │ ├── ReadMe.txt │ ├── TwoXpoModelsForDifferentDatabases.Web.vbproj │ ├── Web.Debug.config │ ├── Web.EasyTest.config │ ├── Web.Release.config │ ├── Web.config │ ├── WebApplication.resx │ └── WebApplication.vb ├── TwoXpoModelsForDifferentDatabases.Win │ ├── App.config │ ├── ExpressApp.ico │ ├── Images │ │ └── ReadMe.txt │ ├── Model.xafml │ ├── Program.vb │ ├── Properties │ │ ├── AssemblyInfo.vb │ │ ├── Resources.Designer.vb │ │ ├── Resources.resx │ │ ├── Settings.Designer.vb │ │ └── Settings.settings │ ├── ReadMe.txt │ ├── TwoXpoModelsForDifferentDatabases.Win.vbproj │ ├── WinApplication.Designer.vb │ ├── WinApplication.resx │ └── WinApplication.vb └── TwoXpoModelsForDifferentDatabases.sln ├── config.json └── media └── 95572a4e-4ac0-4852-bdd4-de411b72df28.png /.gitattributes: -------------------------------------------------------------------------------- 1 | VB/* linguist-vendored 2 | scripts linguist-vendored 3 | *.css linguist-detectable=false 4 | *.aff linguist-detectable=false -------------------------------------------------------------------------------- /.github/workflows/vale.yml: -------------------------------------------------------------------------------- 1 | name: vale-validation 2 | on: 3 | pull_request: 4 | paths: 5 | - README.md 6 | - readme.md 7 | - Readme.md 8 | 9 | jobs: 10 | vale: 11 | name: runner / vale 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: clone repo 15 | uses: actions/checkout@v4 16 | - name: clone vale-styles repo 17 | uses: actions/checkout@v4 18 | with: 19 | repository: DevExpress/vale-styles 20 | path: vale-styles 21 | ssh-key: ${{ secrets.VALE_STYLES_ACCESS_KEY }} 22 | - name: copy vale rules to the root repo 23 | run: shopt -s dotglob && cp -r ./vale-styles/vale/* . 24 | - name: vale linter check 25 | uses: DevExpress/vale-action@reviewdog 26 | with: 27 | files: '["README.md", "readme.md", "Readme.md"]' 28 | fail_on_error: true 29 | filter_mode: nofilter 30 | reporter: github-check 31 | -------------------------------------------------------------------------------- /CS/EFCore/ClassLibrary1/ClassLibrary1.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0 5 | false 6 | false 7 | 1.0.* 8 | 1.0.0.0 9 | Debug;Release;EasyTest 10 | enable 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /CS/EFCore/ClassLibrary1/ClassLibrary1DbContext.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore; 2 | using Microsoft.EntityFrameworkCore.Design; 3 | using DevExpress.ExpressApp.Design; 4 | using DevExpress.ExpressApp.EFCore.DesignTime; 5 | 6 | namespace ClassLibrary1; 7 | 8 | // This code allows our Model Editor to get relevant EF Core metadata at design time. 9 | // For details, please refer to https://supportcenter.devexpress.com/ticket/details/t933891. 10 | public class ClassLibrary1ContextInitializer : DbContextTypesInfoInitializerBase { 11 | protected override DbContext CreateDbContext() { 12 | var optionsBuilder = new DbContextOptionsBuilder() 13 | .UseSqlServer(";") 14 | .UseChangeTrackingProxies() 15 | .UseObjectSpaceLinkProxies(); 16 | return new ClassLibrary1EFCoreDbContext(optionsBuilder.Options); 17 | } 18 | } 19 | //This factory creates DbContext for design-time services. For example, it is required for database migration. 20 | public class ClassLibrary1DesignTimeDbContextFactory : IDesignTimeDbContextFactory { 21 | public ClassLibrary1EFCoreDbContext CreateDbContext(string[] args) { 22 | throw new InvalidOperationException("Make sure that the database connection string and connection provider are correct. After that, uncomment the code below and remove this exception."); 23 | //var optionsBuilder = new DbContextOptionsBuilder(); 24 | //optionsBuilder.UseSqlServer("Integrated Security=SSPI;Pooling=false;Data Source=(localdb)\\mssqllocaldb;Initial Catalog=DB1"); 25 | //optionsBuilder.UseChangeTrackingProxies(); 26 | //optionsBuilder.UseObjectSpaceLinkProxies(); 27 | //return new ClassLibraryEFCoreDbContext(optionsBuilder.Options); 28 | } 29 | } 30 | [TypesInfoInitializer(typeof(ClassLibrary1ContextInitializer))] 31 | public class ClassLibrary1EFCoreDbContext : DbContext { 32 | public ClassLibrary1EFCoreDbContext(DbContextOptions options) : base(options) { 33 | } 34 | public DbSet ModulesInfo1 { get; set; } 35 | public DbSet PersistentClasses1 { get; set; } 36 | 37 | protected override void OnModelCreating(ModelBuilder modelBuilder) { 38 | base.OnModelCreating(modelBuilder); 39 | modelBuilder.HasChangeTrackingStrategy(ChangeTrackingStrategy.ChangingAndChangedNotificationsWithOriginalValues); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /CS/EFCore/ClassLibrary1/ModuleInfo1.cs: -------------------------------------------------------------------------------- 1 | using DevExpress.ExpressApp.Updating; 2 | using DevExpress.Persistent.BaseImpl.EF; 3 | 4 | namespace ClassLibrary1 { 5 | public class ModuleInfo1 : BaseObject, IModuleInfo { 6 | public virtual string Version { get; set; } 7 | public virtual string Name { get; set; } 8 | public virtual string AssemblyFileName { get; set; } 9 | public virtual bool IsMain { get; set; } 10 | public override string ToString() { 11 | return !string.IsNullOrEmpty(Name) ? Name : base.ToString(); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /CS/EFCore/ClassLibrary1/PersistentClass1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using DevExpress.Persistent.Base; 3 | using DevExpress.Persistent.BaseImpl.EF; 4 | 5 | namespace ClassLibrary1 { 6 | [DefaultClassOptions] 7 | public class PersistentClass1 : BaseObject { 8 | public virtual string PersistentProperty1A { get; set; } 9 | public virtual string PersistentProperty1B { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /CS/EFCore/ClassLibrary2/ClassLibrary2.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0 5 | false 6 | false 7 | 1.0.* 8 | 1.0.0.0 9 | Debug;Release;EasyTest 10 | enable 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /CS/EFCore/ClassLibrary2/ClassLibrary2DbContext.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore; 2 | using Microsoft.EntityFrameworkCore.Design; 3 | using DevExpress.ExpressApp.Design; 4 | using DevExpress.ExpressApp.EFCore.DesignTime; 5 | 6 | namespace ClassLibrary2; 7 | 8 | // This code allows our Model Editor to get relevant EF Core metadata at design time. 9 | // For details, please refer to https://supportcenter.devexpress.com/ticket/details/t933891. 10 | public class ClassLibrary2ContextInitializer : DbContextTypesInfoInitializerBase { 11 | protected override DbContext CreateDbContext() { 12 | var optionsBuilder = new DbContextOptionsBuilder() 13 | .UseSqlServer(";") 14 | .UseChangeTrackingProxies() 15 | .UseObjectSpaceLinkProxies(); 16 | return new ClassLibrary2EFCoreDbContext(optionsBuilder.Options); 17 | } 18 | } 19 | //This factory creates DbContext for design-time services. For example, it is required for database migration. 20 | public class ClassLibrary2DesignTimeDbContextFactory : IDesignTimeDbContextFactory { 21 | public ClassLibrary2EFCoreDbContext CreateDbContext(string[] args) { 22 | throw new InvalidOperationException("Make sure that the database connection string and connection provider are correct. After that, uncomment the code below and remove this exception."); 23 | //var optionsBuilder = new DbContextOptionsBuilder(); 24 | //optionsBuilder.UseSqlServer("Integrated Security=SSPI;Pooling=false;Data Source=(localdb)\\mssqllocaldb;Initial Catalog=DB1"); 25 | //optionsBuilder.UseChangeTrackingProxies(); 26 | //optionsBuilder.UseObjectSpaceLinkProxies(); 27 | //return new ClassLibraryEFCoreDbContext(optionsBuilder.Options); 28 | } 29 | } 30 | [TypesInfoInitializer(typeof(ClassLibrary2ContextInitializer))] 31 | public class ClassLibrary2EFCoreDbContext : DbContext { 32 | public ClassLibrary2EFCoreDbContext(DbContextOptions options) : base(options) { 33 | } 34 | public DbSet PersistentClasses2 { get; set; } 35 | 36 | protected override void OnModelCreating(ModelBuilder modelBuilder) { 37 | base.OnModelCreating(modelBuilder); 38 | modelBuilder.HasChangeTrackingStrategy(ChangeTrackingStrategy.ChangingAndChangedNotificationsWithOriginalValues); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /CS/EFCore/ClassLibrary2/PersistentClass2.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using DevExpress.Persistent.Base; 3 | using DevExpress.Persistent.BaseImpl.EF; 4 | 5 | namespace ClassLibrary2 { 6 | [DefaultClassOptions] 7 | public class PersistentClass2 : BaseObject { 8 | public virtual string PersistentPropertyX { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /CS/EFCore/CommonModule/BusinessObjects/ApplicationUser.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.ObjectModel; 2 | using System.ComponentModel; 3 | using DevExpress.ExpressApp; 4 | using DevExpress.ExpressApp.Security; 5 | using DevExpress.Persistent.BaseImpl.EF.PermissionPolicy; 6 | 7 | namespace CommonModule.BusinessObjects; 8 | 9 | [DefaultProperty(nameof(UserName))] 10 | public class ApplicationUser : PermissionPolicyUser, ISecurityUserWithLoginInfo { 11 | public ApplicationUser() : base() { 12 | UserLogins = new ObservableCollection(); 13 | } 14 | 15 | [Browsable(false)] 16 | [DevExpress.ExpressApp.DC.Aggregated] 17 | public virtual IList UserLogins { get; set; } 18 | 19 | IEnumerable IOAuthSecurityUser.UserLogins => UserLogins.OfType(); 20 | 21 | ISecurityUserLoginInfo ISecurityUserWithLoginInfo.CreateUserLoginInfo(string loginProviderName, string providerUserKey) { 22 | ApplicationUserLoginInfo result = ((IObjectSpaceLink)this).ObjectSpace.CreateObject(); 23 | result.LoginProviderName = loginProviderName; 24 | result.ProviderUserKey = providerUserKey; 25 | result.User = this; 26 | return result; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /CS/EFCore/CommonModule/BusinessObjects/ApplicationUserLoginInfo.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | using System.Runtime.CompilerServices; 5 | using DevExpress.ExpressApp; 6 | using DevExpress.ExpressApp.ConditionalAppearance; 7 | using DevExpress.ExpressApp.Security; 8 | 9 | namespace CommonModule.BusinessObjects; 10 | 11 | [Table("PermissionPolicyUserLoginInfo")] 12 | public class ApplicationUserLoginInfo : ISecurityUserLoginInfo { 13 | 14 | public ApplicationUserLoginInfo() { } 15 | 16 | [Browsable(false)] 17 | public virtual Guid ID { get; protected set; } 18 | 19 | [Appearance("PasswordProvider", Enabled = false, Criteria = "!(IsNewObject(this)) and LoginProviderName == '" + SecurityDefaults.PasswordAuthentication + "'", Context = "DetailView")] 20 | public virtual string LoginProviderName { get; set; } 21 | 22 | [Appearance("PasswordProviderUserKey", Enabled = false, Criteria = "!(IsNewObject(this)) and LoginProviderName == '" + SecurityDefaults.PasswordAuthentication + "'", Context = "DetailView")] 23 | public virtual string ProviderUserKey { get; set; } 24 | 25 | [Browsable(false)] 26 | public virtual Guid UserForeignKey { get; set; } 27 | 28 | [Required] 29 | [ForeignKey(nameof(UserForeignKey))] 30 | public virtual ApplicationUser User { get; set; } 31 | 32 | object ISecurityUserLoginInfo.User => User; 33 | } 34 | -------------------------------------------------------------------------------- /CS/EFCore/CommonModule/BusinessObjects/ReadMe.txt: -------------------------------------------------------------------------------- 1 | Folder Description 2 | 3 | The "BusinessObjects" project folder is intended for storing code of your data model. 4 | In XAF, a business object can be implemented as an ORM-based persistent class 5 | or a non-persistent POCO. 6 | 7 | 8 | Relevant Documentation 9 | 10 | Business Model Design 11 | https://docs.devexpress.com/eXpressAppFramework/113461 12 | 13 | Use the Entity Framework Core Data Model 14 | https://docs.devexpress.com/eXpressAppFramework/402972 15 | 16 | Non-Persistent Objects 17 | https://docs.devexpress.com/eXpressAppFramework/116516 18 | 19 | Data Types Supported by built-in Editors 20 | https://docs.devexpress.com/eXpressAppFramework/113014 21 | 22 | Implement Custom Business Classes and Reference Properties (EF Core) 23 | https://docs.devexpress.com/eXpressAppFramework/402978 24 | 25 | Ways to Implement Business Logic 26 | https://docs.devexpress.com/eXpressAppFramework/113710 27 | 28 | Debugging, Unit and Functional Testing 29 | https://docs.devexpress.com/eXpressAppFramework/112572 30 | -------------------------------------------------------------------------------- /CS/EFCore/CommonModule/CommonModule.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0 5 | false 6 | false 7 | 1.0.* 8 | 1.0.0.0 9 | Debug;Release;EasyTest 10 | enable 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /CS/EFCore/CommonModule/Controllers/ReadMe.txt: -------------------------------------------------------------------------------- 1 | Folder Description 2 | 3 | The "Controllers" project folder is intended for storing platform-agnostic Controller classes 4 | that can change the default XAF application flow and add new features. 5 | 6 | 7 | Relevant Documentation 8 | 9 | Controllers and Actions 10 | https://docs.devexpress.com/eXpressAppFramework/112623 11 | 12 | Implement Custom Controllers 13 | https://docs.devexpress.com/eXpressAppFramework/112621 14 | 15 | Define the Scope of Controllers and Actions 16 | https://docs.devexpress.com/eXpressAppFramework/113103 17 | 18 | Ways to Show a View 19 | https://docs.devexpress.com/eXpressAppFramework/112803 20 | 21 | Ways to Implement Business Logic 22 | https://docs.devexpress.com/eXpressAppFramework/113710 23 | 24 | Debugging, Unit and Functional Testing 25 | https://docs.devexpress.com/eXpressAppFramework/112572 26 | -------------------------------------------------------------------------------- /CS/EFCore/CommonModule/DatabaseUpdate/ReadMe.txt: -------------------------------------------------------------------------------- 1 | Folder Description 2 | 3 | The "DatabaseUpdate" project folder is intended for storing code that supplies 4 | initial data (default User objects, etc) and handles a database update when the 5 | application version changes. 6 | 7 | 8 | Relevant Documentation 9 | 10 | Supply Initial Data (EF Core) 11 | https://docs.devexpress.com/eXpressAppFramework/402985 12 | 13 | ModuleUpdater Class 14 | https://docs.devexpress.com/eXpressAppFramework/DevExpress.ExpressApp.Updating.ModuleUpdater 15 | 16 | Application Update 17 | https://docs.devexpress.com/eXpressAppFramework/113239 18 | 19 | Migrations Overview (EF Core) 20 | https://docs.microsoft.com/en-us/ef/core/managing-schemas/migrations 21 | 22 | Debugging, Unit and Functional Testing 23 | https://docs.devexpress.com/eXpressAppFramework/112572 24 | -------------------------------------------------------------------------------- /CS/EFCore/CommonModule/Images/ReadMe.txt: -------------------------------------------------------------------------------- 1 | Folder Description 2 | 3 | The "Images" project folder is intended for storing custom image files. 4 | 5 | 6 | Relevant Documentation 7 | 8 | Add and Override Images 9 | https://docs.devexpress.com/eXpressAppFramework/112792 10 | 11 | Assign a Custom Image 12 | https://docs.devexpress.com/eXpressAppFramework/112744 13 | -------------------------------------------------------------------------------- /CS/EFCore/CommonModule/Model.DesignedDiffs.xafml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /CS/EFCore/CommonModule/ReadMe.txt: -------------------------------------------------------------------------------- 1 | Project Description 2 | 3 | This project implements a platform-agnostic Module. UI-independent application 4 | elements can be implemented here (Business Objects, Controllers, etc.). The root project 5 | folder contains the Module.cs(vb) file with the class that inherits ModuleBase. 6 | This class allows you to view and customize Module components: 7 | referenced modules, Controllers and business classes. Additionally, the root folder 8 | contains Application Model difference files (XAFML files) that keep application 9 | settings specific for the current Module. Difference files can be customized in code 10 | or in the Model Editor. 11 | 12 | 13 | Relevant Documentation 14 | 15 | Application Solution Components 16 | https://docs.devexpress.com/eXpressAppFramework/112569 17 | 18 | XAF Community Extensions 19 | https://www.devexpress.com/products/net/application_framework/#extensions 20 | 21 | Debugging, Unit and Functional Testing 22 | https://docs.devexpress.com/eXpressAppFramework/112572 23 | 24 | ModuleBase Class 25 | https://docs.devexpress.com/eXpressAppFramework/DevExpress.ExpressApp.ModuleBase 26 | 27 | 28 | Application Model 29 | https://docs.devexpress.com/eXpressAppFramework/112579 30 | 31 | Model Editor 32 | https://docs.devexpress.com/eXpressAppFramework/112582 -------------------------------------------------------------------------------- /CS/EFCore/TwoModelsForDifferentDatabases.Blazor.Server/App.razor: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | Not found 8 |

Sorry, there's nothing at this address.

9 |
10 |
11 |
12 | -------------------------------------------------------------------------------- /CS/EFCore/TwoModelsForDifferentDatabases.Blazor.Server/BlazorApplication.cs: -------------------------------------------------------------------------------- 1 | using DevExpress.ExpressApp; 2 | using DevExpress.ExpressApp.ApplicationBuilder; 3 | using DevExpress.ExpressApp.Blazor; 4 | using DevExpress.ExpressApp.Security; 5 | using DevExpress.ExpressApp.Security.ClientServer; 6 | using DevExpress.ExpressApp.SystemModule; 7 | using CommonModule.BusinessObjects; 8 | using Microsoft.EntityFrameworkCore; 9 | using DevExpress.ExpressApp.EFCore; 10 | using DevExpress.EntityFrameworkCore.Security; 11 | 12 | namespace TwoModelsForDifferentDatabases.Blazor.Server; 13 | 14 | public class TwoModelsForDifferentDatabasesBlazorApplication : BlazorApplication { 15 | public TwoModelsForDifferentDatabasesBlazorApplication() { 16 | ApplicationName = "TwoModelsForDifferentDatabases"; 17 | CheckCompatibilityType = DevExpress.ExpressApp.CheckCompatibilityType.DatabaseSchema; 18 | DatabaseVersionMismatch += TwoModelsForDifferentDatabasesBlazorApplication_DatabaseVersionMismatch; 19 | } 20 | protected override void OnSetupStarted() { 21 | base.OnSetupStarted(); 22 | #if DEBUG 23 | if(System.Diagnostics.Debugger.IsAttached && CheckCompatibilityType == CheckCompatibilityType.DatabaseSchema) { 24 | DatabaseUpdateMode = DatabaseUpdateMode.UpdateDatabaseAlways; 25 | } 26 | #endif 27 | } 28 | private void TwoModelsForDifferentDatabasesBlazorApplication_DatabaseVersionMismatch(object sender, DatabaseVersionMismatchEventArgs e) { 29 | #if EASYTEST 30 | e.Updater.Update(); 31 | e.Handled = true; 32 | #else 33 | if(System.Diagnostics.Debugger.IsAttached) { 34 | e.Updater.Update(); 35 | e.Handled = true; 36 | } 37 | else { 38 | string message = "The application cannot connect to the specified database, " + 39 | "because the database doesn't exist, its version is older " + 40 | "than that of the application or its schema does not match " + 41 | "the ORM data model structure. To avoid this error, use one " + 42 | "of the solutions from the https://www.devexpress.com/kb=T367835 KB Article."; 43 | 44 | if(e.CompatibilityError != null && e.CompatibilityError.Exception != null) { 45 | message += "\r\n\r\nInner exception: " + e.CompatibilityError.Exception.Message; 46 | } 47 | throw new InvalidOperationException(message); 48 | } 49 | #endif 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /CS/EFCore/TwoModelsForDifferentDatabases.Blazor.Server/BlazorModule.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using DevExpress.ExpressApp; 3 | using DevExpress.ExpressApp.DC; 4 | using DevExpress.ExpressApp.Model; 5 | using DevExpress.ExpressApp.Editors; 6 | using DevExpress.ExpressApp.Actions; 7 | using DevExpress.ExpressApp.Updating; 8 | using DevExpress.ExpressApp.Model.Core; 9 | using DevExpress.ExpressApp.Model.DomainLogics; 10 | using DevExpress.ExpressApp.Model.NodeGenerators; 11 | using DevExpress.Persistent.BaseImpl.EF; 12 | 13 | namespace TwoModelsForDifferentDatabases.Blazor.Server; 14 | 15 | [ToolboxItemFilter("Xaf.Platform.Blazor")] 16 | // For more typical usage scenarios, be sure to check out https://docs.devexpress.com/eXpressAppFramework/DevExpress.ExpressApp.ModuleBase. 17 | public sealed class TwoModelsForDifferentDatabasesBlazorModule : ModuleBase { 18 | //private void Application_CreateCustomModelDifferenceStore(object sender, CreateCustomModelDifferenceStoreEventArgs e) { 19 | // e.Store = new ModelDifferenceDbStore((XafApplication)sender, typeof(ModelDifference), true, "Blazor"); 20 | // e.Handled = true; 21 | //} 22 | private void Application_CreateCustomUserModelDifferenceStore(object sender, CreateCustomModelDifferenceStoreEventArgs e) { 23 | e.Store = new ModelDifferenceDbStore((XafApplication)sender, typeof(ModelDifference), false, "Blazor"); 24 | e.Handled = true; 25 | } 26 | public TwoModelsForDifferentDatabasesBlazorModule() { 27 | } 28 | public override IEnumerable GetModuleUpdaters(IObjectSpace objectSpace, Version versionFromDB) { 29 | return ModuleUpdater.EmptyModuleUpdaters; 30 | } 31 | public override void Setup(XafApplication application) { 32 | base.Setup(application); 33 | //application.CreateCustomModelDifferenceStore += Application_CreateCustomModelDifferenceStore; 34 | application.CreateCustomUserModelDifferenceStore += Application_CreateCustomUserModelDifferenceStore; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /CS/EFCore/TwoModelsForDifferentDatabases.Blazor.Server/Controllers/ReadMe.txt: -------------------------------------------------------------------------------- 1 | Folder Description 2 | 3 | The "Controllers" project folder is intended for storing Blazor-specific Controller classes 4 | that can change the default XAF application flow and add new features. 5 | 6 | 7 | Relevant Documentation 8 | 9 | Controllers and Actions 10 | https://docs.devexpress.com/eXpressAppFramework/112623 11 | 12 | Implement Custom Controllers 13 | https://docs.devexpress.com/eXpressAppFramework/112621 14 | 15 | Define the Scope of Controllers and Actions 16 | https://docs.devexpress.com/eXpressAppFramework/113103 17 | 18 | Ways to Show a View 19 | https://docs.devexpress.com/eXpressAppFramework/112803 20 | 21 | Ways to Implement Business Logic 22 | https://docs.devexpress.com/eXpressAppFramework/113710 23 | 24 | Debugging, Unit and Functional Testing 25 | https://docs.devexpress.com/eXpressAppFramework/112572 26 | -------------------------------------------------------------------------------- /CS/EFCore/TwoModelsForDifferentDatabases.Blazor.Server/Editors/ReadMe.txt: -------------------------------------------------------------------------------- 1 | Folder Description 2 | 3 | This project folder is intended for storing custom Blazor List Editors, 4 | Property Editors and View Items. 5 | 6 | 7 | Relevant Documentation 8 | 9 | Using a Custom Control that is not Integrated by Default 10 | https://docs.devexpress.com/eXpressAppFramework/113610 11 | 12 | Ways to Access UI Elements and Their Controls 13 | https://docs.devexpress.com/eXpressAppFramework/120092 14 | 15 | Views 16 | https://docs.devexpress.com/eXpressAppFramework/112611 17 | 18 | List Editors 19 | https://docs.devexpress.com/eXpressAppFramework/113189 20 | 21 | View Items 22 | https://docs.devexpress.com/eXpressAppFramework/112612 23 | 24 | Debugging, Unit and Functional Testing 25 | https://docs.devexpress.com/eXpressAppFramework/112572 26 | -------------------------------------------------------------------------------- /CS/EFCore/TwoModelsForDifferentDatabases.Blazor.Server/Images/ReadMe.txt: -------------------------------------------------------------------------------- 1 | Folder Description 2 | 3 | The "Images" project folder is intended for storing custom image files. 4 | 5 | 6 | Relevant Documentation 7 | 8 | Add and Override Images 9 | https://docs.devexpress.com/eXpressAppFramework/112792 10 | 11 | Assign a Custom Image 12 | https://docs.devexpress.com/eXpressAppFramework/112744 13 | -------------------------------------------------------------------------------- /CS/EFCore/TwoModelsForDifferentDatabases.Blazor.Server/Model.xafml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /CS/EFCore/TwoModelsForDifferentDatabases.Blazor.Server/Pages/_Host.cshtml: -------------------------------------------------------------------------------- 1 | @page "/" 2 | @namespace TwoModelsForDifferentDatabases.Blazor.Server 3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 4 | @using DevExpress.ExpressApp.Blazor.Components 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | TwoModelsForDifferentDatabases 15 | 16 | 17 | 18 | 19 | @{ 20 | string userAgent = Request.Headers["User-Agent"]; 21 | bool isIE = userAgent.Contains("MSIE") || userAgent.Contains("Trident"); 22 | } 23 | @if(isIE) { 24 | 25 |
26 |
27 | 28 |
29 |
Internet Explorer is not supported.
30 |

TwoModelsForDifferentDatabases cannot be loaded in Internet Explorer.
Please use a different browser.

31 |
32 |
33 |
34 | } 35 | else { 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 |
49 | 50 |
51 | 52 | 53 | } 54 | 55 | 56 | -------------------------------------------------------------------------------- /CS/EFCore/TwoModelsForDifferentDatabases.Blazor.Server/Program.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using DevExpress.ExpressApp; 3 | using DevExpress.ExpressApp.Blazor.DesignTime; 4 | using DevExpress.ExpressApp.Blazor.Services; 5 | using DevExpress.ExpressApp.Design; 6 | using DevExpress.ExpressApp.Utils; 7 | 8 | namespace TwoModelsForDifferentDatabases.Blazor.Server; 9 | 10 | public class Program : IDesignTimeApplicationFactory { 11 | private static bool ContainsArgument(string[] args, string argument) { 12 | return args.Any(arg => arg.TrimStart('/').TrimStart('-').ToLower() == argument.ToLower()); 13 | } 14 | public static int Main(string[] args) { 15 | if(ContainsArgument(args, "help") || ContainsArgument(args, "h")) { 16 | Console.WriteLine("Updates the database when its version does not match the application's version."); 17 | Console.WriteLine(); 18 | Console.WriteLine($" {Assembly.GetExecutingAssembly().GetName().Name}.exe --updateDatabase [--forceUpdate --silent]"); 19 | Console.WriteLine(); 20 | Console.WriteLine("--forceUpdate - Marks that the database must be updated whether its version matches the application's version or not."); 21 | Console.WriteLine("--silent - Marks that database update proceeds automatically and does not require any interaction with the user."); 22 | Console.WriteLine(); 23 | Console.WriteLine($"Exit codes: 0 - {DBUpdaterStatus.UpdateCompleted}"); 24 | Console.WriteLine($" 1 - {DBUpdaterStatus.UpdateError}"); 25 | Console.WriteLine($" 2 - {DBUpdaterStatus.UpdateNotNeeded}"); 26 | } 27 | else { 28 | DevExpress.ExpressApp.FrameworkSettings.DefaultSettingsCompatibilityMode = DevExpress.ExpressApp.FrameworkSettingsCompatibilityMode.Latest; 29 | IHost host = CreateHostBuilder(args).Build(); 30 | if(ContainsArgument(args, "updateDatabase")) { 31 | using(var serviceScope = host.Services.CreateScope()) { 32 | return serviceScope.ServiceProvider.GetRequiredService().Update(ContainsArgument(args, "forceUpdate"), ContainsArgument(args, "silent")); 33 | } 34 | } 35 | else { 36 | host.Run(); 37 | } 38 | } 39 | return 0; 40 | } 41 | public static IHostBuilder CreateHostBuilder(string[] args) => 42 | Host.CreateDefaultBuilder(args) 43 | .ConfigureWebHostDefaults(webBuilder => { 44 | webBuilder.UseStartup(); 45 | }); 46 | XafApplication IDesignTimeApplicationFactory.Create() { 47 | IHostBuilder hostBuilder = CreateHostBuilder(Array.Empty()); 48 | return DesignTimeApplicationFactoryHelper.Create(hostBuilder); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /CS/EFCore/TwoModelsForDifferentDatabases.Blazor.Server/ReadMe.txt: -------------------------------------------------------------------------------- 1 | Project Description 2 | 3 | This project implements an ASP.NET Core Blazor Server application (https://docs.microsoft.com/en-us/aspnet/core/blazor/). 4 | The root project folder contains the BlazorApplication.cs file with the class that inherits 5 | BlazorApplication. This class allows you to view and customize application components: referenced modules, 6 | security settings, data connection. Additionally, the root folder contains 7 | Application Model difference files (XAFML files) that keep settings 8 | specific to the current application. Difference files can be customized in code 9 | or in the Model Editor. 10 | The appsettings.json file contains database connection, logging, and theme settings (https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration). 11 | 12 | 13 | Relevant Documentation 14 | 15 | Application Solution Components 16 | https://docs.devexpress.com/eXpressAppFramework/112569 17 | 18 | Debugging, Testing and Error Handling 19 | https://docs.devexpress.com/eXpressAppFramework/112572 20 | 21 | XafApplication Class 22 | https://docs.devexpress.com/eXpressAppFramework/DevExpress.ExpressApp.XafApplication 23 | 24 | Application Model (UI Settings Storage) 25 | https://docs.devexpress.com/eXpressAppFramework/112579 26 | 27 | Model Editor 28 | https://docs.devexpress.com/eXpressAppFramework/112582 29 | 30 | ASP.NET Core Blazor UI 31 | https://docs.devexpress.com/eXpressAppFramework/401675/overview/supported-ui-platforms#aspnet-core-blazor-ui 32 | 33 | Frequently Asked Questions - Blazor UI (FAQ) 34 | https://docs.devexpress.com/eXpressAppFramework/403277/support-qa-troubleshooting/frequently-asked-questions-blazor-faq 35 | 36 | Backend WebApi Service 37 | https://docs.devexpress.com/eXpressAppFramework/403394/backend-web-api-service 38 | 39 | XAF Community Extensions 40 | https://www.devexpress.com/products/net/application_framework/#extensions -------------------------------------------------------------------------------- /CS/EFCore/TwoModelsForDifferentDatabases.Blazor.Server/Services/CircuitHandlerProxy.cs: -------------------------------------------------------------------------------- 1 | using DevExpress.ExpressApp.Blazor.Services; 2 | using Microsoft.AspNetCore.Components.Server.Circuits; 3 | 4 | namespace TwoModelsForDifferentDatabases.Blazor.Server.Services; 5 | 6 | internal class CircuitHandlerProxy : CircuitHandler { 7 | private readonly IScopedCircuitHandler scopedCircuitHandler; 8 | public CircuitHandlerProxy(IScopedCircuitHandler scopedCircuitHandler) { 9 | this.scopedCircuitHandler = scopedCircuitHandler; 10 | } 11 | public override Task OnCircuitOpenedAsync(Circuit circuit, CancellationToken cancellationToken) { 12 | return scopedCircuitHandler.OnCircuitOpenedAsync(cancellationToken); 13 | } 14 | public override Task OnConnectionUpAsync(Circuit circuit, CancellationToken cancellationToken) { 15 | return scopedCircuitHandler.OnConnectionUpAsync(cancellationToken); 16 | } 17 | public override Task OnCircuitClosedAsync(Circuit circuit, CancellationToken cancellationToken) { 18 | return scopedCircuitHandler.OnCircuitClosedAsync(cancellationToken); 19 | } 20 | public override Task OnConnectionDownAsync(Circuit circuit, CancellationToken cancellationToken) { 21 | return scopedCircuitHandler.OnConnectionDownAsync(cancellationToken); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /CS/EFCore/TwoModelsForDifferentDatabases.Blazor.Server/Services/ProxyHubConnectionHandler.cs: -------------------------------------------------------------------------------- 1 | using DevExpress.ExpressApp.Blazor.Services; 2 | using Microsoft.AspNetCore.Connections; 3 | using Microsoft.AspNetCore.SignalR; 4 | using Microsoft.Extensions.Options; 5 | 6 | namespace TwoModelsForDifferentDatabases.Blazor.Server.Services; 7 | 8 | internal class ProxyHubConnectionHandler : HubConnectionHandler where THub : Hub { 9 | private readonly IValueManagerStorageContainerInitializer storageContainerInitializer; 10 | public ProxyHubConnectionHandler( 11 | HubLifetimeManager lifetimeManager, 12 | IHubProtocolResolver protocolResolver, 13 | IOptions globalHubOptions, 14 | IOptions> hubOptions, 15 | ILoggerFactory loggerFactory, 16 | IUserIdProvider userIdProvider, 17 | IServiceScopeFactory serviceScopeFactory, 18 | IValueManagerStorageContainerInitializer storageContainerAccessor) 19 | : base(lifetimeManager, protocolResolver, globalHubOptions, hubOptions, loggerFactory, userIdProvider, serviceScopeFactory) { 20 | this.storageContainerInitializer = storageContainerAccessor; 21 | } 22 | 23 | public override Task OnConnectedAsync(ConnectionContext connection) { 24 | storageContainerInitializer.Initialize(); 25 | return base.OnConnectedAsync(connection); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /CS/EFCore/TwoModelsForDifferentDatabases.Blazor.Server/TwoModelsForDifferentDatabases.Blazor.Server.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0 5 | false 6 | false 7 | 1.0.* 8 | 1.0.0.0 9 | Debug;Release;EasyTest 10 | enable 11 | 12 | 13 | 14 | 15 | 16 | 17 | Always 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /CS/EFCore/TwoModelsForDifferentDatabases.Blazor.Server/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System.Net.Http 2 | @using Microsoft.AspNetCore.Authorization 3 | @using Microsoft.AspNetCore.Components.Authorization 4 | @using Microsoft.AspNetCore.Components.Forms 5 | @using Microsoft.AspNetCore.Components.Routing 6 | @using Microsoft.AspNetCore.Components.Web 7 | @using Microsoft.AspNetCore.Components.Web.Virtualization 8 | @using Microsoft.JSInterop 9 | @using DevExpress.Blazor 10 | @using DevExpress.ExpressApp.Blazor.Components 11 | @using TwoModelsForDifferentDatabases.Blazor.Server 12 | -------------------------------------------------------------------------------- /CS/EFCore/TwoModelsForDifferentDatabases.Blazor.Server/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "DetailedErrors": true, 3 | "Logging": { 4 | "LogLevel": { 5 | "Default": "Information", 6 | "Microsoft": "Warning", 7 | "Microsoft.Hosting.Lifetime": "Information", 8 | "DevExpress.ExpressApp": "Information" 9 | } 10 | }, 11 | "DevExpress": { 12 | "ExpressApp": { 13 | "EnableDiagnosticActions": false 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /CS/EFCore/TwoModelsForDifferentDatabases.Blazor.Server/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "ConnectionStrings": { 3 | "ConnectionString0": "Integrated Security=SSPI;Pooling=false;MultipleActiveResultSets=true;Data Source=(localdb)\\mssqllocaldb;Initial Catalog=DB0_EFCore", 4 | "ConnectionString1": "Integrated Security=SSPI;Pooling=false;MultipleActiveResultSets=true;Data Source=(localdb)\\mssqllocaldb;Initial Catalog=DB1_EFCore", 5 | "ConnectionString2": "Integrated Security=SSPI;Pooling=false;MultipleActiveResultSets=true;Data Source=(localdb)\\mssqllocaldb;Initial Catalog=DB2_EFCore", 6 | "EasyTestConnectionString": "Integrated Security=SSPI;Pooling=false;MultipleActiveResultSets=true;Data Source=(localdb)\\mssqllocaldb;Initial Catalog=DB0_EFCore_EasyTest" 7 | }, 8 | "Logging": { 9 | "LogLevel": { 10 | "Default": "Information", 11 | "Microsoft": "Warning", 12 | "Microsoft.Hosting.Lifetime": "Information", 13 | "DevExpress.ExpressApp": "Information" 14 | } 15 | }, 16 | "AllowedHosts": "*", 17 | "DevExpress": { 18 | "ExpressApp": { 19 | "Languages": "en-US;", 20 | "ShowLanguageSwitcher": false, 21 | "ThemeSwitcher": { 22 | "DefaultItemName": "Office White", // This line is changed according to the following BC: https://supportcenter.devexpress.com/internal/ticket/details/t1090666, 23 | "ShowSizeModeSwitcher": true, 24 | "Groups": [ 25 | { 26 | "Caption": "DevExpress Themes", 27 | "Items": [ 28 | { 29 | "Caption": "Blazing Berry", 30 | "Url": "_content/DevExpress.Blazor.Themes/blazing-berry.bs5.min.css", 31 | "Color": "#5c2d91" 32 | }, 33 | { 34 | "Caption": "Blazing Dark", 35 | "Url": "_content/DevExpress.Blazor.Themes/blazing-dark.bs5.min.css", 36 | "Color": "#46444a" 37 | }, 38 | { 39 | "Caption": "Office White", 40 | "Url": "_content/DevExpress.Blazor.Themes/office-white.bs5.min.css", 41 | "Color": "#fe7109" 42 | }, 43 | { 44 | "Caption": "Purple", 45 | "Url": "_content/DevExpress.Blazor.Themes/purple.bs5.min.css", 46 | "Color": "#7989ff" 47 | } 48 | ] 49 | } 50 | ] 51 | } 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /CS/EFCore/TwoModelsForDifferentDatabases.Blazor.Server/wwwroot/css/site.css: -------------------------------------------------------------------------------- 1 | html, body { 2 | height: 100%; 3 | } 4 | 5 | app { 6 | display: block; 7 | height: 100%; 8 | } 9 | 10 | .header-logo { 11 | flex-shrink: 0; 12 | background-color: currentColor; 13 | -webkit-mask: url('../images/Logo.svg'); 14 | mask: url('../images/Logo.svg'); 15 | -webkit-mask-position: center; 16 | mask-position: center; 17 | -webkit-mask-repeat: no-repeat; 18 | mask-repeat: no-repeat; 19 | width: 180px; 20 | height: 24px; 21 | } 22 | 23 | #blazor-error-ui { 24 | background: inherit; 25 | bottom: 0; 26 | display: none; 27 | position: fixed; 28 | width: 100%; 29 | height: 100%; 30 | z-index: 100001; 31 | } -------------------------------------------------------------------------------- /CS/EFCore/TwoModelsForDifferentDatabases.Blazor.Server/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevExpress-Examples/XAF_how-to-connect-different-data-models-to-several-databases-within-a-single-application/fc465de644b709506545cd9e389a77fe0ade37f5/CS/EFCore/TwoModelsForDifferentDatabases.Blazor.Server/wwwroot/favicon.ico -------------------------------------------------------------------------------- /CS/EFCore/TwoModelsForDifferentDatabases.Blazor.Server/wwwroot/images/SplashScreen.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /CS/EFCore/TwoModelsForDifferentDatabases.Win/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | System 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 37 | 38 | -------------------------------------------------------------------------------- /CS/EFCore/TwoModelsForDifferentDatabases.Win/Controllers/ReadMe.txt: -------------------------------------------------------------------------------- 1 | Folder Description 2 | 3 | The "Controllers" project folder is intended for storing WinForms-specific Controller classes 4 | that can change the default XAF application flow and add new features. 5 | 6 | 7 | Relevant Documentation 8 | 9 | Controllers and Actions 10 | https://docs.devexpress.com/eXpressAppFramework/112623 11 | 12 | Implement Custom Controllers 13 | https://docs.devexpress.com/eXpressAppFramework/112621 14 | 15 | Define the Scope of Controllers and Actions 16 | https://docs.devexpress.com/eXpressAppFramework/113103 17 | 18 | Ways to Show a View 19 | https://docs.devexpress.com/eXpressAppFramework/112803 20 | 21 | Ways to Implement Business Logic 22 | https://docs.devexpress.com/eXpressAppFramework/113710 23 | 24 | Debugging, Unit and Functional Testing 25 | https://docs.devexpress.com/eXpressAppFramework/112572 26 | -------------------------------------------------------------------------------- /CS/EFCore/TwoModelsForDifferentDatabases.Win/Editors/ReadMe.txt: -------------------------------------------------------------------------------- 1 | Folder Description 2 | 3 | This project folder is intended for storing custom WinForms List Editors, 4 | Property Editors and View Items. 5 | 6 | 7 | Relevant Documentation 8 | 9 | Using a Custom Control that is not Integrated by Default 10 | https://docs.devexpress.com/eXpressAppFramework/113610 11 | 12 | Ways to Access UI Elements and Their Controls 13 | https://docs.devexpress.com/eXpressAppFramework/120092 14 | 15 | Views 16 | https://docs.devexpress.com/eXpressAppFramework/112611 17 | 18 | List Editors 19 | https://docs.devexpress.com/eXpressAppFramework/113189 20 | 21 | Implement Custom Property Editors 22 | https://docs.devexpress.com/eXpressAppFramework/113097 23 | 24 | View Items 25 | https://docs.devexpress.com/eXpressAppFramework/112612 26 | 27 | How to: Implement a Custom WinForms List Editor 28 | https://docs.devexpress.com/eXpressAppFramework/112659 29 | 30 | How to: Support a Context Menu for a Custom WinForms List Editor 31 | https://docs.devexpress.com/eXpressAppFramework/112660 32 | 33 | How to: Implement a Property Editor (in WinForms Applications) 34 | https://docs.devexpress.com/eXpressAppFramework/112679 35 | 36 | How to: Implement a Property Editor for Specific Data Management (in WinForms Applications) 37 | https://docs.devexpress.com/eXpressAppFramework/113101 38 | 39 | How to: Extend Built-in Property Editor's Functionality 40 | https://docs.devexpress.com/eXpressAppFramework/113104 41 | 42 | How to: Implement a View Item 43 | https://docs.devexpress.com/eXpressAppFramework/112641 44 | 45 | Debugging, Unit and Functional Testing 46 | https://docs.devexpress.com/eXpressAppFramework/112572 47 | -------------------------------------------------------------------------------- /CS/EFCore/TwoModelsForDifferentDatabases.Win/ExpressApp.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevExpress-Examples/XAF_how-to-connect-different-data-models-to-several-databases-within-a-single-application/fc465de644b709506545cd9e389a77fe0ade37f5/CS/EFCore/TwoModelsForDifferentDatabases.Win/ExpressApp.ico -------------------------------------------------------------------------------- /CS/EFCore/TwoModelsForDifferentDatabases.Win/Images/ExpressAppLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevExpress-Examples/XAF_how-to-connect-different-data-models-to-several-databases-within-a-single-application/fc465de644b709506545cd9e389a77fe0ade37f5/CS/EFCore/TwoModelsForDifferentDatabases.Win/Images/ExpressAppLogo.png -------------------------------------------------------------------------------- /CS/EFCore/TwoModelsForDifferentDatabases.Win/Images/Logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 18 | 19 | -------------------------------------------------------------------------------- /CS/EFCore/TwoModelsForDifferentDatabases.Win/Images/ReadMe.txt: -------------------------------------------------------------------------------- 1 | Folder Description 2 | 3 | The "Images" project folder is intended for storing custom image files. 4 | 5 | 6 | Relevant Documentation 7 | 8 | Add and Override Images 9 | https://docs.devexpress.com/eXpressAppFramework/112792 10 | 11 | Assign a Custom Image 12 | https://docs.devexpress.com/eXpressAppFramework/112744 13 | -------------------------------------------------------------------------------- /CS/EFCore/TwoModelsForDifferentDatabases.Win/Model.xafml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /CS/EFCore/TwoModelsForDifferentDatabases.Win/ReadMe.txt: -------------------------------------------------------------------------------- 1 | Project Description 2 | 3 | This project implements a WinForms application. The root project folder 4 | contains the WinApplication.cs file with the class that inherits WinApplication. 5 | This class allows you to view and customize Module components: 6 | referenced modules, Controllers and business classes. Additionally, the root folder 7 | contains Application Model difference files (XAFML files) that keep application 8 | settings specific for the current Module. Difference files can be customized in code 9 | or in the Model Editor. 10 | 11 | 12 | Relevant Documentation 13 | 14 | Application Solution Components 15 | https://docs.devexpress.com/eXpressAppFramework/112569 16 | 17 | XAF Community Extensions 18 | https://www.devexpress.com/products/net/application_framework/#extensions 19 | 20 | Debugging, Unit and Functional Testing 21 | https://docs.devexpress.com/eXpressAppFramework/112572 22 | 23 | WinApplication Class 24 | https://docs.devexpress.com/eXpressAppFramework/DevExpress.ExpressApp.Win.WinApplication 25 | 26 | XafApplication Class 27 | https://docs.devexpress.com/eXpressAppFramework/DevExpress.ExpressApp.XafApplication 28 | 29 | Application Model 30 | https://docs.devexpress.com/eXpressAppFramework/112579 31 | 32 | Model Editor 33 | https://docs.devexpress.com/eXpressAppFramework/112582 -------------------------------------------------------------------------------- /CS/EFCore/TwoModelsForDifferentDatabases.Win/Startup.cs: -------------------------------------------------------------------------------- 1 | using System.Configuration; 2 | using DevExpress.ExpressApp; 3 | using DevExpress.ExpressApp.ApplicationBuilder; 4 | using DevExpress.ExpressApp.Win.ApplicationBuilder; 5 | using DevExpress.ExpressApp.Win; 6 | using Microsoft.EntityFrameworkCore; 7 | using DevExpress.Persistent.BaseImpl.EF.PermissionPolicy; 8 | using DevExpress.ExpressApp.Design; 9 | 10 | namespace TwoModelsForDifferentDatabases.Win; 11 | 12 | public class ApplicationBuilder : IDesignTimeApplicationFactory { 13 | public static WinApplication BuildApplication(string connectionString) { 14 | var builder = WinApplication.CreateBuilder(); 15 | builder.UseApplication(); 16 | builder.Modules 17 | .AddConditionalAppearance() 18 | .AddValidation(options => { 19 | options.AllowValidationDetailsAccess = false; 20 | }) 21 | .Add() 22 | .Add() 23 | .Add() 24 | .Add(); 25 | CommonModule.CommonModule.SetupObjectSpace(builder.ObjectSpaceProviders); 26 | ClassLibrary1.XafModule1.SetupObjectSpace(builder.ObjectSpaceProviders); 27 | ClassLibrary2.XafModule2.SetupObjectSpace(builder.ObjectSpaceProviders); 28 | builder.ObjectSpaceProviders.AddNonPersistent(); 29 | builder.Security 30 | .UseIntegratedMode(options => { 31 | options.RoleType = typeof(PermissionPolicyRole); 32 | options.UserType = typeof(CommonModule.BusinessObjects.ApplicationUser); 33 | options.UserLoginInfoType = typeof(CommonModule.BusinessObjects.ApplicationUserLoginInfo); 34 | }) 35 | .UsePasswordAuthentication(); 36 | builder.AddBuildStep(application => { 37 | application.ConnectionString = connectionString; 38 | #if DEBUG 39 | if(System.Diagnostics.Debugger.IsAttached && application.CheckCompatibilityType == CheckCompatibilityType.DatabaseSchema) { 40 | application.DatabaseUpdateMode = DatabaseUpdateMode.UpdateDatabaseAlways; 41 | } 42 | #endif 43 | }); 44 | var winApplication = builder.Build(); 45 | return winApplication; 46 | } 47 | 48 | XafApplication IDesignTimeApplicationFactory.Create() 49 | => BuildApplication(XafApplication.DesignTimeConnectionString); 50 | } 51 | -------------------------------------------------------------------------------- /CS/EFCore/TwoModelsForDifferentDatabases.Win/TwoModelsForDifferentDatabases.Win.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | WinExe 5 | net8.0-windows 6 | false 7 | true 8 | ExpressApp.ico 9 | false 10 | 1.0.* 11 | 1.0.0.0 12 | Debug;Release;EasyTest 13 | enable 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Always 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /CS/EFCore/TwoModelsForDifferentDatabases.Win/WinApplication.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using DevExpress.ExpressApp; 3 | using DevExpress.ExpressApp.ApplicationBuilder; 4 | using DevExpress.ExpressApp.Win; 5 | using DevExpress.ExpressApp.Updating; 6 | using DevExpress.ExpressApp.Win.Utils; 7 | using DevExpress.ExpressApp.Security; 8 | using DevExpress.ExpressApp.Security.ClientServer; 9 | using Microsoft.EntityFrameworkCore; 10 | using DevExpress.ExpressApp.EFCore; 11 | using DevExpress.EntityFrameworkCore.Security; 12 | using CommonModule.BusinessObjects; 13 | using System.Data.Common; 14 | 15 | namespace TwoModelsForDifferentDatabases.Win; 16 | 17 | // For more typical usage scenarios, be sure to check out https://docs.devexpress.com/eXpressAppFramework/DevExpress.ExpressApp.Win.WinApplication._members 18 | public class TwoModelsForDifferentDatabasesWindowsFormsApplication : WinApplication { 19 | public TwoModelsForDifferentDatabasesWindowsFormsApplication() { 20 | SplashScreen = new DXSplashScreen(typeof(XafSplashScreen), new DefaultOverlayFormOptions()); 21 | ApplicationName = "TwoModelsForDifferentDatabases"; 22 | CheckCompatibilityType = DevExpress.ExpressApp.CheckCompatibilityType.DatabaseSchema; 23 | UseOldTemplates = false; 24 | DatabaseVersionMismatch += TwoModelsForDifferentDatabasesWindowsFormsApplication_DatabaseVersionMismatch; 25 | CustomizeLanguagesList += TwoModelsForDifferentDatabasesWindowsFormsApplication_CustomizeLanguagesList; 26 | } 27 | private void TwoModelsForDifferentDatabasesWindowsFormsApplication_CustomizeLanguagesList(object sender, CustomizeLanguagesListEventArgs e) { 28 | string userLanguageName = System.Threading.Thread.CurrentThread.CurrentUICulture.Name; 29 | if(userLanguageName != "en-US" && e.Languages.IndexOf(userLanguageName) == -1) { 30 | e.Languages.Add(userLanguageName); 31 | } 32 | } 33 | private void TwoModelsForDifferentDatabasesWindowsFormsApplication_DatabaseVersionMismatch(object sender, DevExpress.ExpressApp.DatabaseVersionMismatchEventArgs e) { 34 | #if EASYTEST 35 | e.Updater.Update(); 36 | e.Handled = true; 37 | #else 38 | if(System.Diagnostics.Debugger.IsAttached) { 39 | e.Updater.Update(); 40 | e.Handled = true; 41 | } 42 | else { 43 | string message = "The application cannot connect to the specified database, " + 44 | "because the database doesn't exist, its version is older " + 45 | "than that of the application or its schema does not match " + 46 | "the ORM data model structure. To avoid this error, use one " + 47 | "of the solutions from the https://www.devexpress.com/kb=T367835 KB Article."; 48 | 49 | if(e.CompatibilityError != null && e.CompatibilityError.Exception != null) { 50 | message += "\r\n\r\nInner exception: " + e.CompatibilityError.Exception.Message; 51 | } 52 | throw new InvalidOperationException(message); 53 | } 54 | #endif 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /CS/EFCore/TwoModelsForDifferentDatabases.Win/WinModule.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using DevExpress.ExpressApp; 3 | using DevExpress.ExpressApp.DC; 4 | using DevExpress.ExpressApp.Model; 5 | using DevExpress.ExpressApp.Editors; 6 | using DevExpress.ExpressApp.Actions; 7 | using DevExpress.ExpressApp.Updating; 8 | using DevExpress.ExpressApp.Model.Core; 9 | using DevExpress.ExpressApp.Model.DomainLogics; 10 | using DevExpress.ExpressApp.Model.NodeGenerators; 11 | using DevExpress.Persistent.BaseImpl.EF; 12 | 13 | namespace TwoModelsForDifferentDatabases.Win; 14 | 15 | [ToolboxItemFilter("Xaf.Platform.Win")] 16 | // For more typical usage scenarios, be sure to check out https://docs.devexpress.com/eXpressAppFramework/DevExpress.ExpressApp.ModuleBase. 17 | public sealed class TwoModelsForDifferentDatabasesWinModule : ModuleBase { 18 | //private void Application_CreateCustomModelDifferenceStore(object sender, CreateCustomModelDifferenceStoreEventArgs e) { 19 | // e.Store = new ModelDifferenceDbStore((XafApplication)sender, typeof(ModelDifference), true, "Win"); 20 | // e.Handled = true; 21 | //} 22 | private void Application_CreateCustomUserModelDifferenceStore(object sender, CreateCustomModelDifferenceStoreEventArgs e) { 23 | e.Store = new ModelDifferenceDbStore((XafApplication)sender, typeof(ModelDifference), false, "Win"); 24 | e.Handled = true; 25 | } 26 | public TwoModelsForDifferentDatabasesWinModule() { 27 | DevExpress.ExpressApp.Editors.FormattingProvider.UseMaskSettings = true; 28 | } 29 | public override IEnumerable GetModuleUpdaters(IObjectSpace objectSpace, Version versionFromDB) { 30 | return ModuleUpdater.EmptyModuleUpdaters; 31 | } 32 | public override void Setup(XafApplication application) { 33 | base.Setup(application); 34 | //application.CreateCustomModelDifferenceStore += Application_CreateCustomModelDifferenceStore; 35 | application.CreateCustomUserModelDifferenceStore += Application_CreateCustomUserModelDifferenceStore; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /CS/EFCore/TwoModelsForDifferentDatabases.Win/XafSplashScreen.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Drawing; 3 | using System.IO; 4 | using System.Reflection; 5 | using DevExpress.ExpressApp.Win.Utils; 6 | using DevExpress.Skins; 7 | using DevExpress.Utils.Drawing; 8 | using DevExpress.Utils.Svg; 9 | using DevExpress.XtraSplashScreen; 10 | 11 | namespace TwoModelsForDifferentDatabases.Win { 12 | public partial class XafSplashScreen : SplashScreen { 13 | private void LoadBlankLogo() { 14 | Assembly assembly = Assembly.GetExecutingAssembly(); 15 | string blankLogoResourceName = assembly.GetName().Name + ".Images.Logo.svg"; 16 | Stream svgStream = assembly.GetManifestResourceStream(blankLogoResourceName); 17 | if(svgStream != null) { 18 | svgStream.Position = 0; 19 | peLogo.SvgImage = SvgImage.FromStream(svgStream); 20 | } 21 | } 22 | protected override void DrawContent(GraphicsCache graphicsCache, Skin skin) { 23 | Rectangle bounds = ClientRectangle; 24 | bounds.Width--; bounds.Height--; 25 | graphicsCache.Graphics.DrawRectangle(graphicsCache.GetPen(Color.FromArgb(255, 87, 87, 87), 1), bounds); 26 | } 27 | protected void UpdateLabelsPosition() { 28 | labelApplicationName.CalcBestSize(); 29 | int newLeft = (Width - labelApplicationName.Width) / 2; 30 | labelApplicationName.Location = new Point(newLeft, labelApplicationName.Top); 31 | labelSubtitle.CalcBestSize(); 32 | newLeft = (Width - labelSubtitle.Width) / 2; 33 | labelSubtitle.Location = new Point(newLeft, labelSubtitle.Top); 34 | } 35 | public XafSplashScreen() { 36 | InitializeComponent(); 37 | LoadBlankLogo(); 38 | this.labelCopyright.Text = "Copyright © " + DateTime.Now.Year.ToString() + " Company Name" + System.Environment.NewLine + "All rights reserved."; 39 | UpdateLabelsPosition(); 40 | } 41 | 42 | #region Overrides 43 | 44 | public override void ProcessCommand(Enum cmd, object arg) { 45 | base.ProcessCommand(cmd, arg); 46 | if((UpdateSplashCommand)cmd == UpdateSplashCommand.Description) { 47 | labelStatus.Text = (string)arg; 48 | } 49 | } 50 | 51 | #endregion 52 | 53 | } 54 | } -------------------------------------------------------------------------------- /CS/XPO/.NET/ClassLibrary1/ClassLibrary1.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0 5 | false 6 | false 7 | 1.0.* 8 | 1.0.0.0 9 | Debug;Release;EasyTest 10 | enable 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /CS/XPO/.NET/ClassLibrary1/PersistentClass1.cs: -------------------------------------------------------------------------------- 1 | using DevExpress.Data.Filtering; 2 | using DevExpress.ExpressApp; 3 | using DevExpress.ExpressApp.DC; 4 | using DevExpress.ExpressApp.Model; 5 | using DevExpress.Persistent.Base; 6 | using DevExpress.Persistent.BaseImpl; 7 | using DevExpress.Persistent.Validation; 8 | using DevExpress.Xpo; 9 | using System; 10 | using System.Collections.Generic; 11 | using System.ComponentModel; 12 | using System.Linq; 13 | using System.Text; 14 | 15 | namespace ClassLibrary1 { 16 | [DefaultClassOptions] 17 | public class PersistentClass1 : BaseObject { 18 | public PersistentClass1(Session session) 19 | : base(session) { 20 | } 21 | 22 | private string _PersistentProperty1A; 23 | public string PersistentProperty1A { 24 | get { return _PersistentProperty1A; } 25 | set { SetPropertyValue(nameof(PersistentProperty1A), ref _PersistentProperty1A, value); } 26 | } 27 | 28 | private string _PersistentProperty1B; 29 | public string PersistentProperty1B { 30 | get { return _PersistentProperty1B; } 31 | set { SetPropertyValue(nameof(PersistentProperty1B), ref _PersistentProperty1B, value); } 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /CS/XPO/.NET/ClassLibrary2/ClassLibrary2.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0 5 | false 6 | false 7 | 1.0.* 8 | 1.0.0.0 9 | Debug;Release;EasyTest 10 | enable 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /CS/XPO/.NET/ClassLibrary2/PersistentClass2.cs: -------------------------------------------------------------------------------- 1 | using DevExpress.Data.Filtering; 2 | using DevExpress.ExpressApp; 3 | using DevExpress.ExpressApp.DC; 4 | using DevExpress.ExpressApp.Model; 5 | using DevExpress.Persistent.Base; 6 | using DevExpress.Persistent.BaseImpl; 7 | using DevExpress.Persistent.Validation; 8 | using DevExpress.Xpo; 9 | using System; 10 | using System.Collections.Generic; 11 | using System.ComponentModel; 12 | using System.Linq; 13 | using System.Text; 14 | 15 | namespace ClassLibrary2 { 16 | [DefaultClassOptions] 17 | public class PersistentClass2 : BaseObject { 18 | public PersistentClass2(Session session) 19 | : base(session) { 20 | } 21 | 22 | private string _PersistentProperty2A; 23 | public string PersistentProperty2A { 24 | get { return _PersistentProperty2A; } 25 | set { SetPropertyValue(nameof(PersistentProperty2A), ref _PersistentProperty2A, value); } 26 | } 27 | 28 | private string _PersistentProperty2B; 29 | public string PersistentProperty2B { 30 | get { return _PersistentProperty2B; } 31 | set { SetPropertyValue(nameof(PersistentProperty2B), ref _PersistentProperty2B, value); } 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /CS/XPO/.NET/CommonModule/BusinessObjects/ApplicationUser.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.Text; 3 | using DevExpress.ExpressApp; 4 | using DevExpress.ExpressApp.Security; 5 | using DevExpress.Persistent.BaseImpl.PermissionPolicy; 6 | using DevExpress.Xpo; 7 | 8 | namespace CommonModule.BusinessObjects; 9 | 10 | [MapInheritance(MapInheritanceType.ParentTable)] 11 | [DefaultProperty(nameof(UserName))] 12 | public class ApplicationUser : PermissionPolicyUser, ISecurityUserWithLoginInfo { 13 | public ApplicationUser(Session session) : base(session) { } 14 | 15 | [Browsable(false)] 16 | [Aggregated, Association("User-LoginInfo")] 17 | public XPCollection LoginInfo { 18 | get { return GetCollection(nameof(LoginInfo)); } 19 | } 20 | 21 | IEnumerable IOAuthSecurityUser.UserLogins => LoginInfo.OfType(); 22 | 23 | ISecurityUserLoginInfo ISecurityUserWithLoginInfo.CreateUserLoginInfo(string loginProviderName, string providerUserKey) { 24 | ApplicationUserLoginInfo result = new ApplicationUserLoginInfo(Session); 25 | result.LoginProviderName = loginProviderName; 26 | result.ProviderUserKey = providerUserKey; 27 | result.User = this; 28 | return result; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /CS/XPO/.NET/CommonModule/BusinessObjects/ApplicationUserLoginInfo.cs: -------------------------------------------------------------------------------- 1 | using DevExpress.ExpressApp.ConditionalAppearance; 2 | using DevExpress.ExpressApp.Security; 3 | using DevExpress.Persistent.BaseImpl; 4 | using DevExpress.Xpo; 5 | 6 | namespace CommonModule.BusinessObjects; 7 | 8 | [DeferredDeletion(false)] 9 | [Persistent("PermissionPolicyUserLoginInfo")] 10 | public class ApplicationUserLoginInfo : BaseObject, ISecurityUserLoginInfo { 11 | private string loginProviderName; 12 | private ApplicationUser user; 13 | private string providerUserKey; 14 | public ApplicationUserLoginInfo(Session session) : base(session) { } 15 | 16 | [Indexed("ProviderUserKey", Unique = true)] 17 | [Appearance("PasswordProvider", Enabled = false, Criteria = "!(IsNewObject(this)) and LoginProviderName == '" + SecurityDefaults.PasswordAuthentication + "'", Context = "DetailView")] 18 | public string LoginProviderName { 19 | get { return loginProviderName; } 20 | set { SetPropertyValue(nameof(LoginProviderName), ref loginProviderName, value); } 21 | } 22 | 23 | [Appearance("PasswordProviderUserKey", Enabled = false, Criteria = "!(IsNewObject(this)) and LoginProviderName == '" + SecurityDefaults.PasswordAuthentication + "'", Context = "DetailView")] 24 | public string ProviderUserKey { 25 | get { return providerUserKey; } 26 | set { SetPropertyValue(nameof(ProviderUserKey), ref providerUserKey, value); } 27 | } 28 | 29 | [Association("User-LoginInfo")] 30 | public ApplicationUser User { 31 | get { return user; } 32 | set { SetPropertyValue(nameof(User), ref user, value); } 33 | } 34 | 35 | object ISecurityUserLoginInfo.User => User; 36 | } 37 | -------------------------------------------------------------------------------- /CS/XPO/.NET/CommonModule/BusinessObjects/ReadMe.txt: -------------------------------------------------------------------------------- 1 | Folder Description 2 | 3 | The "BusinessObjects" project folder is intended for storing code of your data model. 4 | In XAF, a business object can be implemented as an ORM-based persistent class 5 | or a non-persistent POCO. 6 | 7 | 8 | Relevant Documentation 9 | 10 | Business Model Design 11 | https://docs.devexpress.com/eXpressAppFramework/113461 12 | 13 | Non-Persistent Objects 14 | https://docs.devexpress.com/eXpressAppFramework/116516 15 | 16 | Data Types Supported by built-in Editors 17 | https://docs.devexpress.com/eXpressAppFramework/113014 18 | 19 | Ways to Add a Business Class (XPO) 20 | https://docs.devexpress.com/eXpressAppFramework/112847 21 | 22 | Ways to Implement Business Logic 23 | https://docs.devexpress.com/eXpressAppFramework/113710 24 | 25 | Debugging, Unit and Functional Testing 26 | https://docs.devexpress.com/eXpressAppFramework/112572 27 | -------------------------------------------------------------------------------- /CS/XPO/.NET/CommonModule/CommonModule.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0 5 | false 6 | false 7 | 1.0.* 8 | 1.0.0.0 9 | Debug;Release;EasyTest 10 | enable 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /CS/XPO/.NET/CommonModule/Controllers/ReadMe.txt: -------------------------------------------------------------------------------- 1 | Folder Description 2 | 3 | The "Controllers" project folder is intended for storing platform-agnostic Controller classes 4 | that can change the default XAF application flow and add new features. 5 | 6 | 7 | Relevant Documentation 8 | 9 | Controllers and Actions 10 | https://docs.devexpress.com/eXpressAppFramework/112623 11 | 12 | Implement Custom Controllers 13 | https://docs.devexpress.com/eXpressAppFramework/112621 14 | 15 | Define the Scope of Controllers and Actions 16 | https://docs.devexpress.com/eXpressAppFramework/113103 17 | 18 | Ways to Show a View 19 | https://docs.devexpress.com/eXpressAppFramework/112803 20 | 21 | Ways to Implement Business Logic 22 | https://docs.devexpress.com/eXpressAppFramework/113710 23 | 24 | Debugging, Unit and Functional Testing 25 | https://docs.devexpress.com/eXpressAppFramework/112572 26 | -------------------------------------------------------------------------------- /CS/XPO/.NET/CommonModule/DatabaseUpdate/ReadMe.txt: -------------------------------------------------------------------------------- 1 | Folder Description 2 | 3 | The "DatabaseUpdate" project folder is intended for storing code that supplies 4 | initial data (default User objects, etc) and handles a database update when the 5 | application version changes. 6 | 7 | 8 | Relevant Documentation 9 | 10 | Supply Initial Data (XPO) 11 | https://docs.devexpress.com/eXpressAppFramework/112788 12 | 13 | ModuleUpdater Class 14 | https://docs.devexpress.com/eXpressAppFramework/DevExpress.ExpressApp.Updating.ModuleUpdater 15 | 16 | Application Update 17 | https://docs.devexpress.com/eXpressAppFramework/113239 18 | 19 | How to: Update the Database Structure after the Persistent Class or Property Was Renamed or Removed (XPO) 20 | https://docs.devexpress.com/eXpressAppFramework/113254 21 | 22 | Debugging, Unit and Functional Testing 23 | https://docs.devexpress.com/eXpressAppFramework/112572 24 | -------------------------------------------------------------------------------- /CS/XPO/.NET/CommonModule/Images/ReadMe.txt: -------------------------------------------------------------------------------- 1 | Folder Description 2 | 3 | The "Images" project folder is intended for storing custom image files. 4 | 5 | 6 | Relevant Documentation 7 | 8 | Add and Override Images 9 | https://docs.devexpress.com/eXpressAppFramework/112792 10 | 11 | Assign a Custom Image 12 | https://docs.devexpress.com/eXpressAppFramework/112744 13 | -------------------------------------------------------------------------------- /CS/XPO/.NET/CommonModule/Model.DesignedDiffs.xafml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /CS/XPO/.NET/CommonModule/ReadMe.txt: -------------------------------------------------------------------------------- 1 | Project Description 2 | 3 | This project implements a platform-agnostic Module. UI-independent application 4 | elements can be implemented here (Business Objects, Controllers, etc.). The root project 5 | folder contains the Module.cs(vb) file with the class that inherits ModuleBase. 6 | This class allows you to view and customize Module components: 7 | referenced modules, Controllers and business classes. Additionally, the root folder 8 | contains Application Model difference files (XAFML files) that keep application 9 | settings specific for the current Module. Difference files can be customized in code 10 | or in the Model Editor. 11 | 12 | 13 | Relevant Documentation 14 | 15 | Application Solution Components 16 | https://docs.devexpress.com/eXpressAppFramework/112569 17 | 18 | XAF Community Extensions 19 | https://www.devexpress.com/products/net/application_framework/#extensions 20 | 21 | Debugging, Unit and Functional Testing 22 | https://docs.devexpress.com/eXpressAppFramework/112572 23 | 24 | ModuleBase Class 25 | https://docs.devexpress.com/eXpressAppFramework/DevExpress.ExpressApp.ModuleBase 26 | 27 | 28 | Application Model 29 | https://docs.devexpress.com/eXpressAppFramework/112579 30 | 31 | Model Editor 32 | https://docs.devexpress.com/eXpressAppFramework/112582 -------------------------------------------------------------------------------- /CS/XPO/.NET/TwoXpoModelsForDifferentDatabases.Blazor.Server/App.razor: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | Not found 8 |

Sorry, there's nothing at this address.

9 |
10 |
11 |
12 | -------------------------------------------------------------------------------- /CS/XPO/.NET/TwoXpoModelsForDifferentDatabases.Blazor.Server/BlazorApplication.cs: -------------------------------------------------------------------------------- 1 | using DevExpress.ExpressApp; 2 | using DevExpress.ExpressApp.ApplicationBuilder; 3 | using DevExpress.ExpressApp.Blazor; 4 | using DevExpress.ExpressApp.Security; 5 | using DevExpress.ExpressApp.Security.ClientServer; 6 | using DevExpress.ExpressApp.SystemModule; 7 | using DevExpress.ExpressApp.Xpo; 8 | using TwoXpoModelsForDifferentDatabases.Blazor.Server.Services; 9 | 10 | namespace TwoXpoModelsForDifferentDatabases.Blazor.Server; 11 | 12 | public class TwoXpoModelsForDifferentDatabasesBlazorApplication : BlazorApplication { 13 | public TwoXpoModelsForDifferentDatabasesBlazorApplication() { 14 | ApplicationName = "TwoXpoModelsForDifferentDatabases"; 15 | CheckCompatibilityType = DevExpress.ExpressApp.CheckCompatibilityType.DatabaseSchema; 16 | DatabaseVersionMismatch += TwoXpoModelsForDifferentDatabasesBlazorApplication_DatabaseVersionMismatch; 17 | } 18 | protected override void OnSetupStarted() { 19 | base.OnSetupStarted(); 20 | #if DEBUG 21 | if(System.Diagnostics.Debugger.IsAttached && CheckCompatibilityType == CheckCompatibilityType.DatabaseSchema) { 22 | DatabaseUpdateMode = DatabaseUpdateMode.UpdateDatabaseAlways; 23 | } 24 | #endif 25 | } 26 | private void TwoXpoModelsForDifferentDatabasesBlazorApplication_DatabaseVersionMismatch(object sender, DatabaseVersionMismatchEventArgs e) { 27 | #if EASYTEST 28 | e.Updater.Update(); 29 | e.Handled = true; 30 | #else 31 | if(System.Diagnostics.Debugger.IsAttached) { 32 | e.Updater.Update(); 33 | e.Handled = true; 34 | } 35 | else { 36 | string message = "The application cannot connect to the specified database, " + 37 | "because the database doesn't exist, its version is older " + 38 | "than that of the application or its schema does not match " + 39 | "the ORM data model structure. To avoid this error, use one " + 40 | "of the solutions from the https://www.devexpress.com/kb=T367835 KB Article."; 41 | 42 | if(e.CompatibilityError != null && e.CompatibilityError.Exception != null) { 43 | message += "\r\n\r\nInner exception: " + e.CompatibilityError.Exception.Message; 44 | } 45 | throw new InvalidOperationException(message); 46 | } 47 | #endif 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /CS/XPO/.NET/TwoXpoModelsForDifferentDatabases.Blazor.Server/BlazorModule.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using DevExpress.ExpressApp; 3 | using DevExpress.ExpressApp.DC; 4 | using DevExpress.ExpressApp.Model; 5 | using DevExpress.ExpressApp.Editors; 6 | using DevExpress.ExpressApp.Actions; 7 | using DevExpress.ExpressApp.Updating; 8 | using DevExpress.ExpressApp.Model.Core; 9 | using DevExpress.ExpressApp.Model.DomainLogics; 10 | using DevExpress.ExpressApp.Model.NodeGenerators; 11 | using DevExpress.Persistent.BaseImpl; 12 | 13 | namespace TwoXpoModelsForDifferentDatabases.Blazor.Server; 14 | 15 | [ToolboxItemFilter("Xaf.Platform.Blazor")] 16 | // For more typical usage scenarios, be sure to check out https://docs.devexpress.com/eXpressAppFramework/DevExpress.ExpressApp.ModuleBase. 17 | public sealed class TwoXpoModelsForDifferentDatabasesBlazorModule : ModuleBase { 18 | //private void Application_CreateCustomModelDifferenceStore(object sender, CreateCustomModelDifferenceStoreEventArgs e) { 19 | // e.Store = new ModelDifferenceDbStore((XafApplication)sender, typeof(ModelDifference), true, "Blazor"); 20 | // e.Handled = true; 21 | //} 22 | private void Application_CreateCustomUserModelDifferenceStore(object sender, CreateCustomModelDifferenceStoreEventArgs e) { 23 | e.Store = new ModelDifferenceDbStore((XafApplication)sender, typeof(ModelDifference), false, "Blazor"); 24 | e.Handled = true; 25 | } 26 | public TwoXpoModelsForDifferentDatabasesBlazorModule() { 27 | } 28 | public override IEnumerable GetModuleUpdaters(IObjectSpace objectSpace, Version versionFromDB) { 29 | return ModuleUpdater.EmptyModuleUpdaters; 30 | } 31 | public override void Setup(XafApplication application) { 32 | base.Setup(application); 33 | //application.CreateCustomModelDifferenceStore += Application_CreateCustomModelDifferenceStore; 34 | application.CreateCustomUserModelDifferenceStore += Application_CreateCustomUserModelDifferenceStore; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /CS/XPO/.NET/TwoXpoModelsForDifferentDatabases.Blazor.Server/Controllers/ReadMe.txt: -------------------------------------------------------------------------------- 1 | Folder Description 2 | 3 | The "Controllers" project folder is intended for storing Blazor-specific Controller classes 4 | that can change the default XAF application flow and add new features. 5 | 6 | 7 | Relevant Documentation 8 | 9 | Controllers and Actions 10 | https://docs.devexpress.com/eXpressAppFramework/112623 11 | 12 | Implement Custom Controllers 13 | https://docs.devexpress.com/eXpressAppFramework/112621 14 | 15 | Define the Scope of Controllers and Actions 16 | https://docs.devexpress.com/eXpressAppFramework/113103 17 | 18 | Ways to Show a View 19 | https://docs.devexpress.com/eXpressAppFramework/112803 20 | 21 | Ways to Implement Business Logic 22 | https://docs.devexpress.com/eXpressAppFramework/113710 23 | 24 | Debugging, Unit and Functional Testing 25 | https://docs.devexpress.com/eXpressAppFramework/112572 26 | -------------------------------------------------------------------------------- /CS/XPO/.NET/TwoXpoModelsForDifferentDatabases.Blazor.Server/Editors/ReadMe.txt: -------------------------------------------------------------------------------- 1 | Folder Description 2 | 3 | This project folder is intended for storing custom Blazor List Editors, 4 | Property Editors and View Items. 5 | 6 | 7 | Relevant Documentation 8 | 9 | Using a Custom Control that is not Integrated by Default 10 | https://docs.devexpress.com/eXpressAppFramework/113610 11 | 12 | Ways to Access UI Elements and Their Controls 13 | https://docs.devexpress.com/eXpressAppFramework/120092 14 | 15 | Views 16 | https://docs.devexpress.com/eXpressAppFramework/112611 17 | 18 | List Editors 19 | https://docs.devexpress.com/eXpressAppFramework/113189 20 | 21 | View Items 22 | https://docs.devexpress.com/eXpressAppFramework/112612 23 | 24 | Debugging, Unit and Functional Testing 25 | https://docs.devexpress.com/eXpressAppFramework/112572 26 | -------------------------------------------------------------------------------- /CS/XPO/.NET/TwoXpoModelsForDifferentDatabases.Blazor.Server/Images/ReadMe.txt: -------------------------------------------------------------------------------- 1 | Folder Description 2 | 3 | The "Images" project folder is intended for storing custom image files. 4 | 5 | 6 | Relevant Documentation 7 | 8 | Add and Override Images 9 | https://docs.devexpress.com/eXpressAppFramework/112792 10 | 11 | Assign a Custom Image 12 | https://docs.devexpress.com/eXpressAppFramework/112744 13 | -------------------------------------------------------------------------------- /CS/XPO/.NET/TwoXpoModelsForDifferentDatabases.Blazor.Server/Model.xafml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /CS/XPO/.NET/TwoXpoModelsForDifferentDatabases.Blazor.Server/Pages/_Host.cshtml: -------------------------------------------------------------------------------- 1 | @page "/" 2 | @namespace TwoXpoModelsForDifferentDatabases.Blazor.Server 3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 4 | @using DevExpress.ExpressApp.Blazor.Components 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | TwoXpoModelsForDifferentDatabases 15 | 16 | 17 | 18 | 19 | @{ 20 | string userAgent = Request.Headers["User-Agent"]; 21 | bool isIE = userAgent.Contains("MSIE") || userAgent.Contains("Trident"); 22 | } 23 | @if(isIE) { 24 | 25 |
26 |
27 | 28 |
29 |
Internet Explorer is not supported.
30 |

TwoXpoModelsForDifferentDatabases cannot be loaded in Internet Explorer.
Please use a different browser.

31 |
32 |
33 |
34 | } 35 | else { 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 |
49 | 50 |
51 | 52 | 53 | } 54 | 55 | 56 | -------------------------------------------------------------------------------- /CS/XPO/.NET/TwoXpoModelsForDifferentDatabases.Blazor.Server/Program.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using DevExpress.ExpressApp; 3 | using DevExpress.ExpressApp.Blazor.DesignTime; 4 | using DevExpress.ExpressApp.Blazor.Services; 5 | using DevExpress.ExpressApp.Design; 6 | using DevExpress.ExpressApp.Utils; 7 | 8 | namespace TwoXpoModelsForDifferentDatabases.Blazor.Server; 9 | 10 | public class Program : IDesignTimeApplicationFactory { 11 | private static bool ContainsArgument(string[] args, string argument) { 12 | return args.Any(arg => arg.TrimStart('/').TrimStart('-').ToLower() == argument.ToLower()); 13 | } 14 | public static int Main(string[] args) { 15 | if(ContainsArgument(args, "help") || ContainsArgument(args, "h")) { 16 | Console.WriteLine("Updates the database when its version does not match the application's version."); 17 | Console.WriteLine(); 18 | Console.WriteLine($" {Assembly.GetExecutingAssembly().GetName().Name}.exe --updateDatabase [--forceUpdate --silent]"); 19 | Console.WriteLine(); 20 | Console.WriteLine("--forceUpdate - Marks that the database must be updated whether its version matches the application's version or not."); 21 | Console.WriteLine("--silent - Marks that database update proceeds automatically and does not require any interaction with the user."); 22 | Console.WriteLine(); 23 | Console.WriteLine($"Exit codes: 0 - {DBUpdaterStatus.UpdateCompleted}"); 24 | Console.WriteLine($" 1 - {DBUpdaterStatus.UpdateError}"); 25 | Console.WriteLine($" 2 - {DBUpdaterStatus.UpdateNotNeeded}"); 26 | } 27 | else { 28 | DevExpress.ExpressApp.FrameworkSettings.DefaultSettingsCompatibilityMode = DevExpress.ExpressApp.FrameworkSettingsCompatibilityMode.Latest; 29 | IHost host = CreateHostBuilder(args).Build(); 30 | if(ContainsArgument(args, "updateDatabase")) { 31 | using(var serviceScope = host.Services.CreateScope()) { 32 | return serviceScope.ServiceProvider.GetRequiredService().Update(ContainsArgument(args, "forceUpdate"), ContainsArgument(args, "silent")); 33 | } 34 | } 35 | else { 36 | host.Run(); 37 | } 38 | } 39 | return 0; 40 | } 41 | public static IHostBuilder CreateHostBuilder(string[] args) => 42 | Host.CreateDefaultBuilder(args) 43 | .ConfigureWebHostDefaults(webBuilder => { 44 | webBuilder.UseStartup(); 45 | }); 46 | XafApplication IDesignTimeApplicationFactory.Create() { 47 | IHostBuilder hostBuilder = CreateHostBuilder(Array.Empty()); 48 | return DesignTimeApplicationFactoryHelper.Create(hostBuilder); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /CS/XPO/.NET/TwoXpoModelsForDifferentDatabases.Blazor.Server/ReadMe.txt: -------------------------------------------------------------------------------- 1 | Project Description 2 | 3 | This project implements an ASP.NET Core Blazor Server application (https://docs.microsoft.com/en-us/aspnet/core/blazor/). 4 | The root project folder contains the BlazorApplication.cs file with the class that inherits 5 | BlazorApplication. This class allows you to view and customize application components: referenced modules, 6 | security settings, data connection. Additionally, the root folder contains 7 | Application Model difference files (XAFML files) that keep settings 8 | specific to the current application. Difference files can be customized in code 9 | or in the Model Editor. 10 | The appsettings.json file contains database connection, logging, and theme settings (https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration). 11 | 12 | 13 | Relevant Documentation 14 | 15 | Application Solution Components 16 | https://docs.devexpress.com/eXpressAppFramework/112569 17 | 18 | Debugging, Testing and Error Handling 19 | https://docs.devexpress.com/eXpressAppFramework/112572 20 | 21 | XafApplication Class 22 | https://docs.devexpress.com/eXpressAppFramework/DevExpress.ExpressApp.XafApplication 23 | 24 | Application Model (UI Settings Storage) 25 | https://docs.devexpress.com/eXpressAppFramework/112579 26 | 27 | Model Editor 28 | https://docs.devexpress.com/eXpressAppFramework/112582 29 | 30 | ASP.NET Core Blazor UI 31 | https://docs.devexpress.com/eXpressAppFramework/401675/overview/supported-ui-platforms#aspnet-core-blazor-ui 32 | 33 | Frequently Asked Questions - Blazor UI (FAQ) 34 | https://docs.devexpress.com/eXpressAppFramework/403277/support-qa-troubleshooting/frequently-asked-questions-blazor-faq 35 | 36 | Backend WebApi Service 37 | https://docs.devexpress.com/eXpressAppFramework/403394/backend-web-api-service 38 | 39 | XAF Community Extensions 40 | https://www.devexpress.com/products/net/application_framework/#extensions -------------------------------------------------------------------------------- /CS/XPO/.NET/TwoXpoModelsForDifferentDatabases.Blazor.Server/Services/CircuitHandlerProxy.cs: -------------------------------------------------------------------------------- 1 | using DevExpress.ExpressApp.Blazor.Services; 2 | using Microsoft.AspNetCore.Components.Server.Circuits; 3 | 4 | namespace TwoXpoModelsForDifferentDatabases.Blazor.Server.Services; 5 | 6 | internal class CircuitHandlerProxy : CircuitHandler { 7 | private readonly IScopedCircuitHandler scopedCircuitHandler; 8 | public CircuitHandlerProxy(IScopedCircuitHandler scopedCircuitHandler) { 9 | this.scopedCircuitHandler = scopedCircuitHandler; 10 | } 11 | public override Task OnCircuitOpenedAsync(Circuit circuit, CancellationToken cancellationToken) { 12 | return scopedCircuitHandler.OnCircuitOpenedAsync(cancellationToken); 13 | } 14 | public override Task OnConnectionUpAsync(Circuit circuit, CancellationToken cancellationToken) { 15 | return scopedCircuitHandler.OnConnectionUpAsync(cancellationToken); 16 | } 17 | public override Task OnCircuitClosedAsync(Circuit circuit, CancellationToken cancellationToken) { 18 | return scopedCircuitHandler.OnCircuitClosedAsync(cancellationToken); 19 | } 20 | public override Task OnConnectionDownAsync(Circuit circuit, CancellationToken cancellationToken) { 21 | return scopedCircuitHandler.OnConnectionDownAsync(cancellationToken); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /CS/XPO/.NET/TwoXpoModelsForDifferentDatabases.Blazor.Server/Services/ProxyHubConnectionHandler.cs: -------------------------------------------------------------------------------- 1 | using DevExpress.ExpressApp.Blazor.Services; 2 | using Microsoft.AspNetCore.Connections; 3 | using Microsoft.AspNetCore.SignalR; 4 | using Microsoft.Extensions.Options; 5 | 6 | namespace TwoXpoModelsForDifferentDatabases.Blazor.Server.Services; 7 | 8 | internal class ProxyHubConnectionHandler : HubConnectionHandler where THub : Hub { 9 | private readonly IValueManagerStorageContainerInitializer storageContainerInitializer; 10 | public ProxyHubConnectionHandler( 11 | HubLifetimeManager lifetimeManager, 12 | IHubProtocolResolver protocolResolver, 13 | IOptions globalHubOptions, 14 | IOptions> hubOptions, 15 | ILoggerFactory loggerFactory, 16 | IUserIdProvider userIdProvider, 17 | IServiceScopeFactory serviceScopeFactory, 18 | IValueManagerStorageContainerInitializer storageContainerAccessor) 19 | : base(lifetimeManager, protocolResolver, globalHubOptions, hubOptions, loggerFactory, userIdProvider, serviceScopeFactory) { 20 | this.storageContainerInitializer = storageContainerAccessor; 21 | } 22 | 23 | public override Task OnConnectedAsync(ConnectionContext connection) { 24 | storageContainerInitializer.Initialize(); 25 | return base.OnConnectedAsync(connection); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /CS/XPO/.NET/TwoXpoModelsForDifferentDatabases.Blazor.Server/TwoXpoModelsForDifferentDatabases.Blazor.Server.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0 5 | false 6 | false 7 | 1.0.* 8 | 1.0.0.0 9 | Debug;Release;EasyTest 10 | enable 11 | 12 | 13 | 14 | 15 | 16 | 17 | Always 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /CS/XPO/.NET/TwoXpoModelsForDifferentDatabases.Blazor.Server/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System.Net.Http 2 | @using Microsoft.AspNetCore.Authorization 3 | @using Microsoft.AspNetCore.Components.Authorization 4 | @using Microsoft.AspNetCore.Components.Forms 5 | @using Microsoft.AspNetCore.Components.Routing 6 | @using Microsoft.AspNetCore.Components.Web 7 | @using Microsoft.AspNetCore.Components.Web.Virtualization 8 | @using Microsoft.JSInterop 9 | @using DevExpress.Blazor 10 | @using DevExpress.ExpressApp.Blazor.Components 11 | @using TwoXpoModelsForDifferentDatabases.Blazor.Server 12 | -------------------------------------------------------------------------------- /CS/XPO/.NET/TwoXpoModelsForDifferentDatabases.Blazor.Server/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "DetailedErrors": true, 3 | "Logging": { 4 | "LogLevel": { 5 | "Default": "Information", 6 | "Microsoft": "Warning", 7 | "Microsoft.Hosting.Lifetime": "Information", 8 | "DevExpress.ExpressApp": "Information" 9 | } 10 | }, 11 | "DevExpress": { 12 | "ExpressApp": { 13 | "EnableDiagnosticActions": false 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /CS/XPO/.NET/TwoXpoModelsForDifferentDatabases.Blazor.Server/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "ConnectionStrings": { 3 | "ConnectionString0": "Integrated Security=SSPI;Pooling=false;Data Source=(localdb)\\mssqllocaldb;Initial Catalog=DB0_XPO", 4 | "ConnectionString1": "Integrated Security=SSPI;Pooling=false;Data Source=(localdb)\\mssqllocaldb;Initial Catalog=DB1_XPO", 5 | "ConnectionString2": "Integrated Security=SSPI;Pooling=false;Data Source=(localdb)\\mssqllocaldb;Initial Catalog=DB2_XPO", 6 | "EasyTestConnectionString": "Integrated Security=SSPI;Pooling=false;Data Source=(localdb)\\mssqllocaldb;Initial Catalog=TwoXpoModelsForDifferentDatabasesEasyTest" 7 | }, 8 | "Logging": { 9 | "LogLevel": { 10 | "Default": "Information", 11 | "Microsoft": "Warning", 12 | "Microsoft.Hosting.Lifetime": "Information", 13 | "DevExpress.ExpressApp": "Information" 14 | } 15 | }, 16 | "AllowedHosts": "*", 17 | "DevExpress": { 18 | "ExpressApp": { 19 | "Languages": "en-US;", 20 | "ShowLanguageSwitcher": false, 21 | "ThemeSwitcher": { 22 | "DefaultItemName": "Office White", // This line is changed according to the following BC: https://supportcenter.devexpress.com/internal/ticket/details/t1090666, 23 | "ShowSizeModeSwitcher": true, 24 | "Groups": [ 25 | { 26 | "Caption": "DevExpress Themes", 27 | "Items": [ 28 | { 29 | "Caption": "Blazing Berry", 30 | "Url": "_content/DevExpress.Blazor.Themes/blazing-berry.bs5.min.css", 31 | "Color": "#5c2d91" 32 | }, 33 | { 34 | "Caption": "Blazing Dark", 35 | "Url": "_content/DevExpress.Blazor.Themes/blazing-dark.bs5.min.css", 36 | "Color": "#46444a" 37 | }, 38 | { 39 | "Caption": "Office White", 40 | "Url": "_content/DevExpress.Blazor.Themes/office-white.bs5.min.css", 41 | "Color": "#fe7109" 42 | }, 43 | { 44 | "Caption": "Purple", 45 | "Url": "_content/DevExpress.Blazor.Themes/purple.bs5.min.css", 46 | "Color": "#7989ff" 47 | } 48 | ] 49 | } 50 | ] 51 | } 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /CS/XPO/.NET/TwoXpoModelsForDifferentDatabases.Blazor.Server/wwwroot/css/site.css: -------------------------------------------------------------------------------- 1 | html, body { 2 | height: 100%; 3 | } 4 | 5 | app { 6 | display: block; 7 | height: 100%; 8 | } 9 | 10 | .header-logo { 11 | flex-shrink: 0; 12 | background-color: currentColor; 13 | -webkit-mask: url('../images/Logo.svg'); 14 | mask: url('../images/Logo.svg'); 15 | -webkit-mask-position: center; 16 | mask-position: center; 17 | -webkit-mask-repeat: no-repeat; 18 | mask-repeat: no-repeat; 19 | width: 180px; 20 | height: 24px; 21 | } 22 | 23 | #blazor-error-ui { 24 | background: inherit; 25 | bottom: 0; 26 | display: none; 27 | position: fixed; 28 | width: 100%; 29 | height: 100%; 30 | z-index: 100001; 31 | } -------------------------------------------------------------------------------- /CS/XPO/.NET/TwoXpoModelsForDifferentDatabases.Blazor.Server/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevExpress-Examples/XAF_how-to-connect-different-data-models-to-several-databases-within-a-single-application/fc465de644b709506545cd9e389a77fe0ade37f5/CS/XPO/.NET/TwoXpoModelsForDifferentDatabases.Blazor.Server/wwwroot/favicon.ico -------------------------------------------------------------------------------- /CS/XPO/.NET/TwoXpoModelsForDifferentDatabases.Blazor.Server/wwwroot/images/SplashScreen.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /CS/XPO/.NET/TwoXpoModelsForDifferentDatabases.Win/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | System 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 37 | 38 | -------------------------------------------------------------------------------- /CS/XPO/.NET/TwoXpoModelsForDifferentDatabases.Win/Controllers/ReadMe.txt: -------------------------------------------------------------------------------- 1 | Folder Description 2 | 3 | The "Controllers" project folder is intended for storing WinForms-specific Controller classes 4 | that can change the default XAF application flow and add new features. 5 | 6 | 7 | Relevant Documentation 8 | 9 | Controllers and Actions 10 | https://docs.devexpress.com/eXpressAppFramework/112623 11 | 12 | Implement Custom Controllers 13 | https://docs.devexpress.com/eXpressAppFramework/112621 14 | 15 | Define the Scope of Controllers and Actions 16 | https://docs.devexpress.com/eXpressAppFramework/113103 17 | 18 | Ways to Show a View 19 | https://docs.devexpress.com/eXpressAppFramework/112803 20 | 21 | Ways to Implement Business Logic 22 | https://docs.devexpress.com/eXpressAppFramework/113710 23 | 24 | Debugging, Unit and Functional Testing 25 | https://docs.devexpress.com/eXpressAppFramework/112572 26 | -------------------------------------------------------------------------------- /CS/XPO/.NET/TwoXpoModelsForDifferentDatabases.Win/Editors/ReadMe.txt: -------------------------------------------------------------------------------- 1 | Folder Description 2 | 3 | This project folder is intended for storing custom WinForms List Editors, 4 | Property Editors and View Items. 5 | 6 | 7 | Relevant Documentation 8 | 9 | Using a Custom Control that is not Integrated by Default 10 | https://docs.devexpress.com/eXpressAppFramework/113610 11 | 12 | Ways to Access UI Elements and Their Controls 13 | https://docs.devexpress.com/eXpressAppFramework/120092 14 | 15 | Views 16 | https://docs.devexpress.com/eXpressAppFramework/112611 17 | 18 | List Editors 19 | https://docs.devexpress.com/eXpressAppFramework/113189 20 | 21 | Implement Custom Property Editors 22 | https://docs.devexpress.com/eXpressAppFramework/113097 23 | 24 | View Items 25 | https://docs.devexpress.com/eXpressAppFramework/112612 26 | 27 | How to: Implement a Custom WinForms List Editor 28 | https://docs.devexpress.com/eXpressAppFramework/112659 29 | 30 | How to: Support a Context Menu for a Custom WinForms List Editor 31 | https://docs.devexpress.com/eXpressAppFramework/112660 32 | 33 | How to: Implement a Property Editor (in WinForms Applications) 34 | https://docs.devexpress.com/eXpressAppFramework/112679 35 | 36 | How to: Implement a Property Editor for Specific Data Management (in WinForms Applications) 37 | https://docs.devexpress.com/eXpressAppFramework/113101 38 | 39 | How to: Extend Built-in Property Editor's Functionality 40 | https://docs.devexpress.com/eXpressAppFramework/113104 41 | 42 | How to: Implement a View Item 43 | https://docs.devexpress.com/eXpressAppFramework/112641 44 | 45 | Debugging, Unit and Functional Testing 46 | https://docs.devexpress.com/eXpressAppFramework/112572 47 | -------------------------------------------------------------------------------- /CS/XPO/.NET/TwoXpoModelsForDifferentDatabases.Win/ExpressApp.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevExpress-Examples/XAF_how-to-connect-different-data-models-to-several-databases-within-a-single-application/fc465de644b709506545cd9e389a77fe0ade37f5/CS/XPO/.NET/TwoXpoModelsForDifferentDatabases.Win/ExpressApp.ico -------------------------------------------------------------------------------- /CS/XPO/.NET/TwoXpoModelsForDifferentDatabases.Win/Images/ExpressAppLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevExpress-Examples/XAF_how-to-connect-different-data-models-to-several-databases-within-a-single-application/fc465de644b709506545cd9e389a77fe0ade37f5/CS/XPO/.NET/TwoXpoModelsForDifferentDatabases.Win/Images/ExpressAppLogo.png -------------------------------------------------------------------------------- /CS/XPO/.NET/TwoXpoModelsForDifferentDatabases.Win/Images/Logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 18 | 19 | -------------------------------------------------------------------------------- /CS/XPO/.NET/TwoXpoModelsForDifferentDatabases.Win/Images/ReadMe.txt: -------------------------------------------------------------------------------- 1 | Folder Description 2 | 3 | The "Images" project folder is intended for storing custom image files. 4 | 5 | 6 | Relevant Documentation 7 | 8 | Add and Override Images 9 | https://docs.devexpress.com/eXpressAppFramework/112792 10 | 11 | Assign a Custom Image 12 | https://docs.devexpress.com/eXpressAppFramework/112744 13 | -------------------------------------------------------------------------------- /CS/XPO/.NET/TwoXpoModelsForDifferentDatabases.Win/Model.xafml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /CS/XPO/.NET/TwoXpoModelsForDifferentDatabases.Win/ReadMe.txt: -------------------------------------------------------------------------------- 1 | Project Description 2 | 3 | This project implements a WinForms application. The root project folder 4 | contains the WinApplication.cs file with the class that inherits WinApplication. 5 | This class allows you to view and customize Module components: 6 | referenced modules, Controllers and business classes. Additionally, the root folder 7 | contains Application Model difference files (XAFML files) that keep application 8 | settings specific for the current Module. Difference files can be customized in code 9 | or in the Model Editor. 10 | 11 | 12 | Relevant Documentation 13 | 14 | Application Solution Components 15 | https://docs.devexpress.com/eXpressAppFramework/112569 16 | 17 | XAF Community Extensions 18 | https://www.devexpress.com/products/net/application_framework/#extensions 19 | 20 | Debugging, Unit and Functional Testing 21 | https://docs.devexpress.com/eXpressAppFramework/112572 22 | 23 | WinApplication Class 24 | https://docs.devexpress.com/eXpressAppFramework/DevExpress.ExpressApp.Win.WinApplication 25 | 26 | XafApplication Class 27 | https://docs.devexpress.com/eXpressAppFramework/DevExpress.ExpressApp.XafApplication 28 | 29 | Application Model 30 | https://docs.devexpress.com/eXpressAppFramework/112579 31 | 32 | Model Editor 33 | https://docs.devexpress.com/eXpressAppFramework/112582 -------------------------------------------------------------------------------- /CS/XPO/.NET/TwoXpoModelsForDifferentDatabases.Win/Startup.cs: -------------------------------------------------------------------------------- 1 | using System.Configuration; 2 | using DevExpress.ExpressApp; 3 | using DevExpress.ExpressApp.ApplicationBuilder; 4 | using DevExpress.ExpressApp.Win.ApplicationBuilder; 5 | using DevExpress.ExpressApp.Security; 6 | using DevExpress.ExpressApp.Win; 7 | using DevExpress.Persistent.Base; 8 | using DevExpress.Persistent.BaseImpl; 9 | using DevExpress.XtraEditors; 10 | using DevExpress.Persistent.BaseImpl.PermissionPolicy; 11 | using DevExpress.ExpressApp.Design; 12 | 13 | namespace TwoXpoModelsForDifferentDatabases.Win; 14 | 15 | public class ApplicationBuilder : IDesignTimeApplicationFactory { 16 | public static WinApplication BuildApplication(string connectionString) { 17 | var builder = WinApplication.CreateBuilder(); 18 | builder.UseApplication(); 19 | builder.Modules 20 | .AddConditionalAppearance() 21 | .AddValidation(options => { 22 | options.AllowValidationDetailsAccess = false; 23 | }) 24 | .Add() 25 | .Add() 26 | .Add() 27 | .Add(); 28 | builder.ObjectSpaceProviders.AddNonPersistent(); 29 | CommonModule.CommonModule.SetupObjectSpace(builder.ObjectSpaceProviders); 30 | ClassLibrary1.XafModule1.SetupObjectSpace(builder.ObjectSpaceProviders); 31 | ClassLibrary2.XafModule2.SetupObjectSpace(builder.ObjectSpaceProviders); 32 | builder.Security 33 | .UseIntegratedMode(options => { 34 | options.RoleType = typeof(PermissionPolicyRole); 35 | options.UserType = typeof(CommonModule.BusinessObjects.ApplicationUser); 36 | options.UserLoginInfoType = typeof(CommonModule.BusinessObjects.ApplicationUserLoginInfo); 37 | options.UseXpoPermissionsCaching(); 38 | }) 39 | .UsePasswordAuthentication(); 40 | builder.AddBuildStep(application => { 41 | application.ConnectionString = connectionString; 42 | #if DEBUG 43 | if(System.Diagnostics.Debugger.IsAttached && application.CheckCompatibilityType == CheckCompatibilityType.DatabaseSchema) { 44 | application.DatabaseUpdateMode = DatabaseUpdateMode.UpdateDatabaseAlways; 45 | } 46 | #endif 47 | }); 48 | var winApplication = builder.Build(); 49 | return winApplication; 50 | } 51 | 52 | XafApplication IDesignTimeApplicationFactory.Create() 53 | => BuildApplication(XafApplication.DesignTimeConnectionString); 54 | } 55 | -------------------------------------------------------------------------------- /CS/XPO/.NET/TwoXpoModelsForDifferentDatabases.Win/TwoXpoModelsForDifferentDatabases.Win.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | WinExe 5 | net8.0-windows 6 | false 7 | true 8 | ExpressApp.ico 9 | false 10 | 1.0.* 11 | 1.0.0.0 12 | Debug;Release;EasyTest 13 | enable 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Always 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /CS/XPO/.NET/TwoXpoModelsForDifferentDatabases.Win/WinApplication.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using DevExpress.ExpressApp; 3 | using DevExpress.ExpressApp.ApplicationBuilder; 4 | using DevExpress.ExpressApp.Win; 5 | using DevExpress.ExpressApp.Updating; 6 | using DevExpress.ExpressApp.Win.Utils; 7 | using DevExpress.ExpressApp.Xpo; 8 | using DevExpress.ExpressApp.Security; 9 | using DevExpress.ExpressApp.Security.ClientServer; 10 | 11 | namespace TwoXpoModelsForDifferentDatabases.Win; 12 | 13 | // For more typical usage scenarios, be sure to check out https://docs.devexpress.com/eXpressAppFramework/DevExpress.ExpressApp.Win.WinApplication._members 14 | public class TwoXpoModelsForDifferentDatabasesWindowsFormsApplication : WinApplication { 15 | public TwoXpoModelsForDifferentDatabasesWindowsFormsApplication() { 16 | SplashScreen = new DXSplashScreen(typeof(XafSplashScreen), new DefaultOverlayFormOptions()); 17 | ApplicationName = "TwoXpoModelsForDifferentDatabases"; 18 | CheckCompatibilityType = DevExpress.ExpressApp.CheckCompatibilityType.DatabaseSchema; 19 | UseOldTemplates = false; 20 | DatabaseVersionMismatch += TwoXpoModelsForDifferentDatabasesWindowsFormsApplication_DatabaseVersionMismatch; 21 | CustomizeLanguagesList += TwoXpoModelsForDifferentDatabasesWindowsFormsApplication_CustomizeLanguagesList; 22 | } 23 | private void TwoXpoModelsForDifferentDatabasesWindowsFormsApplication_CustomizeLanguagesList(object sender, CustomizeLanguagesListEventArgs e) { 24 | string userLanguageName = System.Threading.Thread.CurrentThread.CurrentUICulture.Name; 25 | if(userLanguageName != "en-US" && e.Languages.IndexOf(userLanguageName) == -1) { 26 | e.Languages.Add(userLanguageName); 27 | } 28 | } 29 | private void TwoXpoModelsForDifferentDatabasesWindowsFormsApplication_DatabaseVersionMismatch(object sender, DevExpress.ExpressApp.DatabaseVersionMismatchEventArgs e) { 30 | #if EASYTEST 31 | e.Updater.Update(); 32 | e.Handled = true; 33 | #else 34 | if(System.Diagnostics.Debugger.IsAttached) { 35 | e.Updater.Update(); 36 | e.Handled = true; 37 | } 38 | else { 39 | string message = "The application cannot connect to the specified database, " + 40 | "because the database doesn't exist, its version is older " + 41 | "than that of the application or its schema does not match " + 42 | "the ORM data model structure. To avoid this error, use one " + 43 | "of the solutions from the https://www.devexpress.com/kb=T367835 KB Article."; 44 | 45 | if(e.CompatibilityError != null && e.CompatibilityError.Exception != null) { 46 | message += "\r\n\r\nInner exception: " + e.CompatibilityError.Exception.Message; 47 | } 48 | throw new InvalidOperationException(message); 49 | } 50 | #endif 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /CS/XPO/.NET/TwoXpoModelsForDifferentDatabases.Win/WinModule.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using DevExpress.ExpressApp; 3 | using DevExpress.ExpressApp.DC; 4 | using DevExpress.ExpressApp.Model; 5 | using DevExpress.ExpressApp.Editors; 6 | using DevExpress.ExpressApp.Actions; 7 | using DevExpress.ExpressApp.Updating; 8 | using DevExpress.ExpressApp.Model.Core; 9 | using DevExpress.ExpressApp.Model.DomainLogics; 10 | using DevExpress.ExpressApp.Model.NodeGenerators; 11 | using DevExpress.Persistent.BaseImpl; 12 | 13 | namespace TwoXpoModelsForDifferentDatabases.Win; 14 | 15 | [ToolboxItemFilter("Xaf.Platform.Win")] 16 | // For more typical usage scenarios, be sure to check out https://docs.devexpress.com/eXpressAppFramework/DevExpress.ExpressApp.ModuleBase. 17 | public sealed class TwoXpoModelsForDifferentDatabasesWinModule : ModuleBase { 18 | //private void Application_CreateCustomModelDifferenceStore(object sender, CreateCustomModelDifferenceStoreEventArgs e) { 19 | // e.Store = new ModelDifferenceDbStore((XafApplication)sender, typeof(ModelDifference), true, "Win"); 20 | // e.Handled = true; 21 | //} 22 | private void Application_CreateCustomUserModelDifferenceStore(object sender, CreateCustomModelDifferenceStoreEventArgs e) { 23 | e.Store = new ModelDifferenceDbStore((XafApplication)sender, typeof(ModelDifference), false, "Win"); 24 | e.Handled = true; 25 | } 26 | public TwoXpoModelsForDifferentDatabasesWinModule() { 27 | DevExpress.ExpressApp.Editors.FormattingProvider.UseMaskSettings = true; 28 | } 29 | public override IEnumerable GetModuleUpdaters(IObjectSpace objectSpace, Version versionFromDB) { 30 | return ModuleUpdater.EmptyModuleUpdaters; 31 | } 32 | public override void Setup(XafApplication application) { 33 | base.Setup(application); 34 | //application.CreateCustomModelDifferenceStore += Application_CreateCustomModelDifferenceStore; 35 | application.CreateCustomUserModelDifferenceStore += Application_CreateCustomUserModelDifferenceStore; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /CS/XPO/.NET/TwoXpoModelsForDifferentDatabases.Win/XafSplashScreen.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Drawing; 3 | using System.IO; 4 | using System.Reflection; 5 | using DevExpress.ExpressApp.Win.Utils; 6 | using DevExpress.Skins; 7 | using DevExpress.Utils.Drawing; 8 | using DevExpress.Utils.Svg; 9 | using DevExpress.XtraSplashScreen; 10 | 11 | namespace TwoXpoModelsForDifferentDatabases.Win { 12 | public partial class XafSplashScreen : SplashScreen { 13 | private void LoadBlankLogo() { 14 | Assembly assembly = Assembly.GetExecutingAssembly(); 15 | string blankLogoResourceName = assembly.GetName().Name + ".Images.Logo.svg"; 16 | Stream svgStream = assembly.GetManifestResourceStream(blankLogoResourceName); 17 | if(svgStream != null) { 18 | svgStream.Position = 0; 19 | peLogo.SvgImage = SvgImage.FromStream(svgStream); 20 | } 21 | } 22 | protected override void DrawContent(GraphicsCache graphicsCache, Skin skin) { 23 | Rectangle bounds = ClientRectangle; 24 | bounds.Width--; bounds.Height--; 25 | graphicsCache.Graphics.DrawRectangle(graphicsCache.GetPen(Color.FromArgb(255, 87, 87, 87), 1), bounds); 26 | } 27 | protected void UpdateLabelsPosition() { 28 | labelApplicationName.CalcBestSize(); 29 | int newLeft = (Width - labelApplicationName.Width) / 2; 30 | labelApplicationName.Location = new Point(newLeft, labelApplicationName.Top); 31 | labelSubtitle.CalcBestSize(); 32 | newLeft = (Width - labelSubtitle.Width) / 2; 33 | labelSubtitle.Location = new Point(newLeft, labelSubtitle.Top); 34 | } 35 | public XafSplashScreen() { 36 | InitializeComponent(); 37 | LoadBlankLogo(); 38 | this.labelCopyright.Text = "Copyright © " + DateTime.Now.Year.ToString() + " Company Name" + System.Environment.NewLine + "All rights reserved."; 39 | UpdateLabelsPosition(); 40 | } 41 | 42 | #region Overrides 43 | 44 | public override void ProcessCommand(Enum cmd, object arg) { 45 | base.ProcessCommand(cmd, arg); 46 | if((UpdateSplashCommand)cmd == UpdateSplashCommand.Description) { 47 | labelStatus.Text = (string)arg; 48 | } 49 | } 50 | 51 | #endregion 52 | 53 | } 54 | } -------------------------------------------------------------------------------- /CS/XPO/.NetFramework/ClassLibrary1/ModuleInfo1.cs: -------------------------------------------------------------------------------- 1 | using DevExpress.Xpo; 2 | using System.Configuration; 3 | using DevExpress.ExpressApp; 4 | using DevExpress.ExpressApp.DC; 5 | using DevExpress.ExpressApp.Xpo; 6 | using DevExpress.ExpressApp.DC.Xpo; 7 | using DevExpress.ExpressApp.Updating; 8 | 9 | namespace ClassLibrary1 { 10 | [MemberDesignTimeVisibility(false)] 11 | public class ModuleInfo1 : XPBaseObject, IModuleInfo { 12 | public ModuleInfo1(Session session) : base(session) { } 13 | [Key(true)] 14 | public int ID { get; set; } 15 | public string Version { get; set; } 16 | public string Name { get; set; } 17 | public string AssemblyFileName { get; set; } 18 | public bool IsMain { get; set; } 19 | public override string ToString() { 20 | return !string.IsNullOrEmpty(Name) ? Name : base.ToString(); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /CS/XPO/.NetFramework/ClassLibrary1/PersistentClass1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using DevExpress.Xpo; 4 | using System.Collections.Generic; 5 | using DevExpress.Persistent.Base; 6 | 7 | namespace ClassLibrary1 { 8 | [DefaultClassOptions] 9 | public class PersistentClass1 : XPObject { 10 | public PersistentClass1(Session session) : base(session) { } 11 | private string _PersistentProperty1A; 12 | public string PersistentProperty1A { 13 | get { return _PersistentProperty1A; } 14 | set { SetPropertyValue(nameof(PersistentProperty1A), ref _PersistentProperty1A, value); } 15 | } 16 | private string _PersistentProperty1B; 17 | public string PersistentProperty1B { 18 | get { return _PersistentProperty1B; } 19 | set { SetPropertyValue(nameof(PersistentProperty1B), ref _PersistentProperty1B, value); } 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /CS/XPO/.NetFramework/ClassLibrary1/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("ClassLibrary1")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ClassLibrary1")] 13 | [assembly: AssemblyCopyright("Copyright © 2013")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("ed1ffb21-a30d-4cab-9121-31487b404b3a")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /CS/XPO/.NetFramework/ClassLibrary2/PersistentClass2.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using DevExpress.Xpo; 4 | using System.Collections.Generic; 5 | using DevExpress.Persistent.Base; 6 | 7 | namespace ClassLibrary2 { 8 | [DefaultClassOptions] 9 | public class PersistentClass2 : XPObject { 10 | public PersistentClass2(Session session) : base(session) { } 11 | private string _PersistentPropertyX; 12 | public string PersistentPropertyX { 13 | get { return _PersistentPropertyX; } 14 | set { SetPropertyValue(nameof(PersistentPropertyX), ref _PersistentPropertyX, value); } 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /CS/XPO/.NetFramework/ClassLibrary2/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("ClassLibrary2")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ClassLibrary2")] 13 | [assembly: AssemblyCopyright("Copyright © 2013")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("71b588c1-2dc8-4a56-9f81-ea1c5e9a79c8")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /CS/XPO/.NetFramework/CommonModule/BusinessObjects/ApplicationUser.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Text; 6 | using DevExpress.ExpressApp; 7 | using DevExpress.ExpressApp.Security; 8 | using DevExpress.Persistent.BaseImpl.PermissionPolicy; 9 | using DevExpress.Xpo; 10 | 11 | namespace CommonModule.BusinessObjects { 12 | [MapInheritance(MapInheritanceType.ParentTable)] 13 | [System.ComponentModel.DisplayName("User"), DefaultProperty(nameof(UserName))] 14 | public class ApplicationUser : PermissionPolicyUser, IObjectSpaceLink, ISecurityUserWithLoginInfo { 15 | public ApplicationUser(Session session) : base(session) { } 16 | 17 | [Browsable(false)] 18 | [Aggregated, Association("User-LoginInfo")] 19 | public XPCollection LoginInfo { 20 | get { return GetCollection(nameof(LoginInfo)); } 21 | } 22 | 23 | IEnumerable IOAuthSecurityUser.UserLogins => LoginInfo.OfType(); 24 | 25 | IObjectSpace IObjectSpaceLink.ObjectSpace { get; set; } 26 | 27 | ISecurityUserLoginInfo ISecurityUserWithLoginInfo.CreateUserLoginInfo(string loginProviderName, string providerUserKey) { 28 | ApplicationUserLoginInfo result = ((IObjectSpaceLink)this).ObjectSpace.CreateObject(); 29 | result.LoginProviderName = loginProviderName; 30 | result.ProviderUserKey = providerUserKey; 31 | result.User = this; 32 | return result; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /CS/XPO/.NetFramework/CommonModule/BusinessObjects/ApplicationUserLoginInfo.cs: -------------------------------------------------------------------------------- 1 | using DevExpress.ExpressApp.ConditionalAppearance; 2 | using DevExpress.ExpressApp.Security; 3 | using DevExpress.Persistent.BaseImpl; 4 | using DevExpress.Xpo; 5 | 6 | namespace CommonModule.BusinessObjects { 7 | [DeferredDeletion(false)] 8 | [Persistent("PermissionPolicyUserLoginInfo")] 9 | public class ApplicationUserLoginInfo : BaseObject, ISecurityUserLoginInfo { 10 | private string loginProviderName; 11 | private ApplicationUser user; 12 | private string providerUserKey; 13 | public ApplicationUserLoginInfo(Session session) : base(session) { } 14 | 15 | [Indexed("ProviderUserKey", Unique = true)] 16 | [Appearance("PasswordProvider", Enabled = false, Criteria = "!(IsNewObject(this)) and LoginProviderName == '" + SecurityDefaults.PasswordAuthentication + "'", Context = "DetailView")] 17 | public string LoginProviderName { 18 | get { return loginProviderName; } 19 | set { SetPropertyValue(nameof(LoginProviderName), ref loginProviderName, value); } 20 | } 21 | 22 | [Appearance("PasswordProviderUserKey", Enabled = false, Criteria = "!(IsNewObject(this)) and LoginProviderName == '" + SecurityDefaults.PasswordAuthentication + "'", Context = "DetailView")] 23 | public string ProviderUserKey { 24 | get { return providerUserKey; } 25 | set { SetPropertyValue(nameof(ProviderUserKey), ref providerUserKey, value); } 26 | } 27 | 28 | [Association("User-LoginInfo")] 29 | public ApplicationUser User { 30 | get { return user; } 31 | set { SetPropertyValue(nameof(User), ref user, value); } 32 | } 33 | 34 | object ISecurityUserLoginInfo.User => User; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /CS/XPO/.NetFramework/CommonModule/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("CommonModule")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("CommonModule")] 13 | [assembly: AssemblyCopyright("Copyright © 2021")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("103a782b-ae3c-43c6-990e-c41a8f0c5feb")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /CS/XPO/.NetFramework/TwoXpoModelsForDifferentDatabases.Web/.gitignore: -------------------------------------------------------------------------------- 1 | # Build results 2 | [Bb]in/ 3 | -------------------------------------------------------------------------------- /CS/XPO/.NetFramework/TwoXpoModelsForDifferentDatabases.Web/Default.aspx: -------------------------------------------------------------------------------- 1 | <%@ Page Language="C#" AutoEventWireup="true" Inherits="Default" EnableViewState="false" 2 | ValidateRequest="false" CodeBehind="Default.aspx.cs" %> 3 | <%@ Register Assembly="DevExpress.ExpressApp.Web.v24.2" Namespace="DevExpress.ExpressApp.Web.Templates" 4 | TagPrefix="cc3" %> 5 | <%@ Register Assembly="DevExpress.ExpressApp.Web.v24.2" Namespace="DevExpress.ExpressApp.Web.Controls" 6 | TagPrefix="cc4" %> 7 | 8 | 9 | 10 | Main Page 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /CS/XPO/.NetFramework/TwoXpoModelsForDifferentDatabases.Web/Default.aspx.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Web.UI; 4 | using DevExpress.ExpressApp.Templates; 5 | using DevExpress.ExpressApp.Web; 6 | using DevExpress.ExpressApp.Web.Templates; 7 | using DevExpress.ExpressApp.Web.Templates.ActionContainers; 8 | 9 | public partial class Default : BaseXafPage { 10 | protected override ContextActionsMenu CreateContextActionsMenu() { 11 | return new ContextActionsMenu(this, "Edit", "RecordEdit", "ObjectsCreation", "ListView", "Reports"); 12 | } 13 | public override Control InnerContentPlaceHolder { 14 | get { 15 | return Content; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /CS/XPO/.NetFramework/TwoXpoModelsForDifferentDatabases.Web/Default.aspx.designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:2.0.50727.5448 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | 12 | 13 | public partial class Default { 14 | 15 | /// 16 | /// form2 control. 17 | /// 18 | /// 19 | /// Auto-generated field. 20 | /// To modify move field declaration from designer file to code-behind file. 21 | /// 22 | protected global::System.Web.UI.HtmlControls.HtmlForm form2; 23 | 24 | /// 25 | /// UPPopupWindowControl control. 26 | /// 27 | /// 28 | /// Auto-generated field. 29 | /// To modify move field declaration from designer file to code-behind file. 30 | /// 31 | protected global::DevExpress.ExpressApp.Web.Templates.XafUpdatePanel UPPopupWindowControl; 32 | 33 | /// 34 | /// PopupWindowControl control. 35 | /// 36 | /// 37 | /// Auto-generated field. 38 | /// To modify move field declaration from designer file to code-behind file. 39 | /// 40 | protected global::DevExpress.ExpressApp.Web.Controls.XafPopupWindowControl PopupWindowControl; 41 | 42 | /// 43 | /// ProgressControl control. 44 | /// 45 | /// 46 | /// Auto-generated field. 47 | /// To modify move field declaration from designer file to code-behind file. 48 | /// 49 | protected global::DevExpress.ExpressApp.Web.Controls.ASPxProgressControl ProgressControl; 50 | 51 | /// 52 | /// Content control. 53 | /// 54 | /// 55 | /// Auto-generated field. 56 | /// To modify move field declaration from designer file to code-behind file. 57 | /// 58 | protected global::System.Web.UI.HtmlControls.HtmlGenericControl Content; 59 | } 60 | -------------------------------------------------------------------------------- /CS/XPO/.NetFramework/TwoXpoModelsForDifferentDatabases.Web/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Language="C#" CodeBehind="Global.asax.cs" Inherits="TwoXpoModelsForDifferentDatabases.Web.Global"%> 2 | -------------------------------------------------------------------------------- /CS/XPO/.NetFramework/TwoXpoModelsForDifferentDatabases.Web/Login.aspx: -------------------------------------------------------------------------------- 1 | <%@ Page Language="C#" AutoEventWireup="true" Inherits="LoginPage" EnableViewState="false" CodeBehind="Login.aspx.cs" %> 2 | <%@ Register Assembly="DevExpress.ExpressApp.Web.v24.2" Namespace="DevExpress.ExpressApp.Web.Templates.ActionContainers" 3 | TagPrefix="cc2" %> 4 | <%@ Register Assembly="DevExpress.ExpressApp.Web.v24.2" Namespace="DevExpress.ExpressApp.Web.Templates.Controls" 5 | TagPrefix="tc" %> 6 | <%@ Register Assembly="DevExpress.ExpressApp.Web.v24.2" Namespace="DevExpress.ExpressApp.Web.Controls" 7 | TagPrefix="cc4" %> 8 | <%@ Register Assembly="DevExpress.ExpressApp.Web.v24.2" Namespace="DevExpress.ExpressApp.Web.Templates" 9 | TagPrefix="cc3" %> 10 | 11 | 12 | 13 | Logon 14 | 15 | 16 |
17 |
18 | 19 |
20 | 21 |
22 | 23 | 24 | -------------------------------------------------------------------------------- /CS/XPO/.NetFramework/TwoXpoModelsForDifferentDatabases.Web/Login.aspx.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using DevExpress.ExpressApp.Web; 4 | using DevExpress.ExpressApp.Web.Templates; 5 | 6 | public partial class LoginPage : BaseXafPage { 7 | public override System.Web.UI.Control InnerContentPlaceHolder { 8 | get { 9 | return Content; 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /CS/XPO/.NetFramework/TwoXpoModelsForDifferentDatabases.Web/Login.aspx.designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:2.0.50727.5448 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | 12 | 13 | public partial class LoginPage { 14 | 15 | /// 16 | /// Head1 control. 17 | /// 18 | /// 19 | /// Auto-generated field. 20 | /// To modify move field declaration from designer file to code-behind file. 21 | /// 22 | protected global::System.Web.UI.HtmlControls.HtmlHead Head1; 23 | 24 | /// 25 | /// form1 control. 26 | /// 27 | /// 28 | /// Auto-generated field. 29 | /// To modify move field declaration from designer file to code-behind file. 30 | /// 31 | protected global::System.Web.UI.HtmlControls.HtmlForm form1; 32 | 33 | /// 34 | /// ProgressControl control. 35 | /// 36 | /// 37 | /// Auto-generated field. 38 | /// To modify move field declaration from designer file to code-behind file. 39 | /// 40 | protected global::DevExpress.ExpressApp.Web.Controls.ASPxProgressControl ProgressControl; 41 | 42 | /// 43 | /// Content control. 44 | /// 45 | /// 46 | /// Auto-generated field. 47 | /// To modify move field declaration from designer file to code-behind file. 48 | /// 49 | protected global::System.Web.UI.HtmlControls.HtmlGenericControl Content; 50 | } 51 | -------------------------------------------------------------------------------- /CS/XPO/.NetFramework/TwoXpoModelsForDifferentDatabases.Web/Model.xafml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /CS/XPO/.NetFramework/TwoXpoModelsForDifferentDatabases.Web/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("TwoXpoModelsForDifferentDatabases.Web")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("-")] 12 | [assembly: AssemblyProduct("TwoXpoModelsForDifferentDatabases.Web")] 13 | [assembly: AssemblyCopyright("Copyright © - 2008")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("3d5900ae-111a-45be-96b3-d9e4606ca793")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Revision and Build Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /CS/XPO/.NetFramework/TwoXpoModelsForDifferentDatabases.Web/ReadMe.txt: -------------------------------------------------------------------------------- 1 | Project Description 2 | 3 | This project implements an ASP.NET application. The ApplicationCode project 4 | folder contains the WebApplication.cs(vb) file with the class that inherits 5 | WebApplication. This class can be designed with the Application Designer that 6 | allows you to view and customize application components: referenced modules, 7 | security settings, data connection. Additionally, the root folder contains 8 | Application Model difference files (XAFML files) that keep application settings 9 | specific for the current application. Differences files can be designed with 10 | the Model Editor. 11 | 12 | 13 | Relevant Documentation 14 | 15 | Application Solution Components 16 | http://help.devexpress.com/#Xaf/CustomDocument2569 17 | 18 | WebApplication Class 19 | http://help.devexpress.com/#Xaf/clsDevExpressExpressWebWebApplicationtopic 20 | 21 | XafApplication Class 22 | http://help.devexpress.com/#Xaf/clsDevExpressExpressXafApplicationtopic 23 | 24 | Application Designer 25 | http://help.devexpress.com/#Xaf/CustomDocument2827 26 | 27 | Application Model 28 | http://help.devexpress.com/#Xaf/CustomDocument2579 29 | 30 | Model Editor 31 | http://help.devexpress.com/#Xaf/CustomDocument2582 32 | 33 | 34 | eXpand Framework - http://www.expandframework.com 35 | 36 | This is an open source toolkit built above the eXpressApp Framework extending its capabilities 37 | and providing 50+ cutting-edge libraries containing tools and reusable modules to target numerous 38 | business scenarios. The main idea behind eXpand is to offer as many features as possible to 39 | developers/business users through a declarative approach (configuring files rather than writing code). 40 | -------------------------------------------------------------------------------- /CS/XPO/.NetFramework/TwoXpoModelsForDifferentDatabases.Web/Web.Debug.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 14 | 15 | 26 | 27 | -------------------------------------------------------------------------------- /CS/XPO/.NetFramework/TwoXpoModelsForDifferentDatabases.Web/Web.EasyTest.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 14 | 15 | 16 | 27 | 28 | -------------------------------------------------------------------------------- /CS/XPO/.NetFramework/TwoXpoModelsForDifferentDatabases.Web/Web.Release.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 14 | 15 | 16 | 27 | 28 | -------------------------------------------------------------------------------- /CS/XPO/.NetFramework/TwoXpoModelsForDifferentDatabases.Win/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 23 | 27 | 31 | 32 | 33 | 34 | 35 | 36 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /CS/XPO/.NetFramework/TwoXpoModelsForDifferentDatabases.Win/ExpressApp.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevExpress-Examples/XAF_how-to-connect-different-data-models-to-several-databases-within-a-single-application/fc465de644b709506545cd9e389a77fe0ade37f5/CS/XPO/.NetFramework/TwoXpoModelsForDifferentDatabases.Win/ExpressApp.ico -------------------------------------------------------------------------------- /CS/XPO/.NetFramework/TwoXpoModelsForDifferentDatabases.Win/Images/ReadMe.txt: -------------------------------------------------------------------------------- 1 | Folder Description 2 | 3 | The "Images" project folder is intended for storing custom image files. 4 | 5 | 6 | Relevant Documentation 7 | 8 | Add and Override Images 9 | http://help.devexpress.com/#Xaf/CustomDocument2792 10 | 11 | Assign a Custom Image 12 | http://help.devexpress.com/#Xaf/CustomDocument2744 13 | -------------------------------------------------------------------------------- /CS/XPO/.NetFramework/TwoXpoModelsForDifferentDatabases.Win/Model.xafml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CS/XPO/.NetFramework/TwoXpoModelsForDifferentDatabases.Win/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Configuration; 3 | using System.Windows.Forms; 4 | using DevExpress.ExpressApp; 5 | using DevExpress.ExpressApp.Security; 6 | using DevExpress.ExpressApp.Win; 7 | using DevExpress.Persistent.Base; 8 | using DevExpress.Persistent.BaseImpl; 9 | 10 | namespace TwoXpoModelsForDifferentDatabases.Win { 11 | static class Program { 12 | /// 13 | /// The main entry point for the application. 14 | /// 15 | [STAThread] 16 | static void Main() { 17 | DevExpress.ExpressApp.FrameworkSettings.DefaultSettingsCompatibilityMode = DevExpress.ExpressApp.FrameworkSettingsCompatibilityMode.v20_1; 18 | #if EASYTEST 19 | DevExpress.ExpressApp.Win.EasyTest.EasyTestRemotingRegistration.Register(); 20 | #endif 21 | 22 | Application.EnableVisualStyles(); 23 | Application.SetCompatibleTextRenderingDefault(false); 24 | EditModelPermission.AlwaysGranted = System.Diagnostics.Debugger.IsAttached; 25 | TwoXpoModelsForDifferentDatabasesWindowsFormsApplication winApplication = new TwoXpoModelsForDifferentDatabasesWindowsFormsApplication(); 26 | DevExpress.ExpressApp.Utils.ImageLoader.Instance.UseSvgImages = true; 27 | winApplication.UseLightStyle = true; 28 | DevExpress.ExpressApp.Utils.ImageLoader.Instance.UseSvgImages = true; 29 | // Refer to the http://documentation.devexpress.com/#Xaf/CustomDocument2680 help article for more details on how to provide a custom splash form. 30 | //winApplication.SplashScreen = new DevExpress.ExpressApp.Win.Utils.DXSplashScreen("YourSplashImage.png"); 31 | #if EASYTEST 32 | //if(ConfigurationManager.ConnectionStrings["EasyTestConnectionString"] != null) { 33 | // winApplication.ConnectionString = ConfigurationManager.ConnectionStrings["EasyTestConnectionString"].ConnectionString; 34 | //} 35 | #endif 36 | //if(ConfigurationManager.ConnectionStrings["ConnectionString"] != null) { 37 | // winApplication.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; 38 | //} 39 | #if DEBUG 40 | if (System.Diagnostics.Debugger.IsAttached) { 41 | winApplication.DatabaseUpdateMode = DatabaseUpdateMode.UpdateDatabaseAlways; 42 | } 43 | #endif 44 | try { 45 | winApplication.Setup(); 46 | winApplication.Start(); 47 | } 48 | catch(Exception e) { 49 | winApplication.HandleException(e); 50 | } 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /CS/XPO/.NetFramework/TwoXpoModelsForDifferentDatabases.Win/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("TwoXpoModelsForDifferentDatabases.Win")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("-")] 12 | [assembly: AssemblyProduct("TwoXpoModelsForDifferentDatabases.Win")] 13 | [assembly: AssemblyCopyright("Copyright © - 2007")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // Version information for an assembly consists of the following four values: 23 | // 24 | // Major Version 25 | // Minor Version 26 | // Build Number 27 | // Revision 28 | // 29 | // You can specify all the values or you can default the Revision and Build Numbers 30 | // by using the '*' as shown below: 31 | [assembly: AssemblyVersion("1.0.0.0")] 32 | 33 | [assembly: AssemblyFileVersionAttribute("1.0.0.0")] 34 | -------------------------------------------------------------------------------- /CS/XPO/.NetFramework/TwoXpoModelsForDifferentDatabases.Win/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace TwoXpoModelsForDifferentDatabases.Win.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TwoXpoModelsForDifferentDatabases.Win.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /CS/XPO/.NetFramework/TwoXpoModelsForDifferentDatabases.Win/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace TwoXpoModelsForDifferentDatabases.Win.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /CS/XPO/.NetFramework/TwoXpoModelsForDifferentDatabases.Win/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CS/XPO/.NetFramework/TwoXpoModelsForDifferentDatabases.Win/ReadMe.txt: -------------------------------------------------------------------------------- 1 | Project Description 2 | 3 | This project implements a Windows Forms application. The root project folder 4 | contains the WinApplication.cs(vb) file with the class that inherits 5 | WinApplication. This class can be designed with the Application Designer that 6 | allows you to view and customize application components: referenced modules, 7 | security settings, data connection. Additionally, the root folder contains 8 | Application Model difference files (XAFML files) that keep application settings 9 | specific for the current application. Differences files can be designed with 10 | the Model Editor. 11 | 12 | 13 | Relevant Documentation 14 | 15 | Application Solution Components 16 | http://help.devexpress.com/#Xaf/CustomDocument2569 17 | 18 | WinApplication Class 19 | http://help.devexpress.com/#Xaf/clsDevExpressExpressWinWinApplicationtopic 20 | 21 | XafApplication Class 22 | http://help.devexpress.com/#Xaf/clsDevExpressExpressXafApplicationtopic 23 | 24 | Application Designer 25 | http://help.devexpress.com/#Xaf/CustomDocument2827 26 | 27 | Application Model 28 | http://help.devexpress.com/#Xaf/CustomDocument2579 29 | 30 | Model Editor 31 | http://help.devexpress.com/#Xaf/CustomDocument2582 32 | 33 | 34 | eXpand Framework - http://www.expandframework.com 35 | 36 | This is an open source toolkit built above the eXpressApp Framework extending its capabilities 37 | and providing 50+ cutting-edge libraries containing tools and reusable modules to target numerous 38 | business scenarios. The main idea behind eXpand is to offer as many features as possible to 39 | developers/business users through a declarative approach (configuring files rather than writing code). 40 | -------------------------------------------------------------------------------- /CS/XPO/.NetFramework/TwoXpoModelsForDifferentDatabases.Win/WinApplication.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using DevExpress.ExpressApp; 3 | using DevExpress.ExpressApp.Win; 4 | //using DevExpress.ExpressApp.Security; 5 | 6 | namespace TwoXpoModelsForDifferentDatabases.Win { 7 | public partial class TwoXpoModelsForDifferentDatabasesWindowsFormsApplication : WinApplication { 8 | public TwoXpoModelsForDifferentDatabasesWindowsFormsApplication() { 9 | InitializeComponent(); 10 | DelayedViewItemsInitialization = true; 11 | } 12 | private void TwoXpoModelsForDifferentDatabasesWindowsFormsApplication_CustomizeLanguagesList(object sender, CustomizeLanguagesListEventArgs e) { 13 | string userLanguageName = System.Threading.Thread.CurrentThread.CurrentUICulture.Name; 14 | if(userLanguageName != "en-US" && e.Languages.IndexOf(userLanguageName) == -1) { 15 | e.Languages.Add(userLanguageName); 16 | } 17 | } 18 | private void TwoXpoModelsForDifferentDatabasesWindowsFormsApplication_DatabaseVersionMismatch(object sender, DevExpress.ExpressApp.DatabaseVersionMismatchEventArgs e) { 19 | #if EASYTEST 20 | e.Updater.Update(); 21 | e.Handled = true; 22 | #else 23 | if(System.Diagnostics.Debugger.IsAttached) { 24 | e.Updater.Update(); 25 | e.Handled = true; 26 | } 27 | else { 28 | throw new InvalidOperationException( 29 | "The application cannot connect to the specified database, because the latter doesn't exist or its version is older than that of the application.\r\n" + 30 | "This error occurred because the automatic database update was disabled when the application was started without debugging.\r\n" + 31 | "To avoid this error, you should either start the application under Visual Studio in debug mode, or modify the " + 32 | "source code of the 'DatabaseVersionMismatch' event handler to enable automatic database update, " + 33 | "or manually create a database using the 'DBUpdater' tool.\r\n" + 34 | "Anyway, refer to the 'Update Application and Database Versions' help topic at http://www.devexpress.com/Help/?document=ExpressApp/CustomDocument2795.htm " + 35 | "for more detailed information. If this doesn't help, please contact our Support Team at http://www.devexpress.com/Support/Center/"); 36 | } 37 | #endif 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This code example is provided "as is" without warranty of any kind. Developer Express Inc ("DevExpress") disclaims all warranties, 2 | either express or implied, including the warranties of merchantability and fitness for a particular purpose. 3 | 4 | For licensing terms and conditions of DevExpress product(s) required for, or associated with the use of this code example, 5 | please refer to the applicable End-User License Agreement at https://www.devexpress.com/Support/licensingfaq.xml -------------------------------------------------------------------------------- /VB/ClassLibrary1/ModuleInfo1.vb: -------------------------------------------------------------------------------- 1 | Imports DevExpress.Xpo 2 | Imports DevExpress.ExpressApp 3 | Imports DevExpress.ExpressApp.DC 4 | Imports DevExpress.ExpressApp.Xpo 5 | Imports DevExpress.ExpressApp.DC.Xpo 6 | Imports DevExpress.ExpressApp.Updating 7 | 8 | Namespace ClassLibrary1 9 | 10 | 11 | Public Class ModuleInfo1 12 | Inherits XPBaseObject 13 | Implements IModuleInfo 14 | 15 | Public Sub New(ByVal session As Session) 16 | MyBase.New(session) 17 | End Sub 18 | 19 | 20 | Public Property ID As Integer 21 | 22 | Public Property Version As String Implements IModuleInfo.Version 23 | 24 | Public Property Name As String Implements IModuleInfo.Name 25 | 26 | Public Property AssemblyFileName As String Implements IModuleInfo.AssemblyFileName 27 | 28 | Public Property IsMain As Boolean Implements IModuleInfo.IsMain 29 | 30 | Public Overrides Function ToString() As String 31 | Return If(Not String.IsNullOrEmpty(Name), Name, MyBase.ToString()) 32 | End Function 33 | End Class 34 | End Namespace 35 | -------------------------------------------------------------------------------- /VB/ClassLibrary1/PersistentClass1.vb: -------------------------------------------------------------------------------- 1 | Imports DevExpress.Xpo 2 | Imports DevExpress.Persistent.Base 3 | 4 | Namespace ClassLibrary1 5 | 6 | 7 | Public Class PersistentClass1 8 | Inherits XPObject 9 | 10 | Public Sub New(ByVal session As Session) 11 | MyBase.New(session) 12 | End Sub 13 | 14 | Private _PersistentProperty1A As String 15 | 16 | Public Property PersistentProperty1A As String 17 | Get 18 | Return _PersistentProperty1A 19 | End Get 20 | 21 | Set(ByVal value As String) 22 | SetPropertyValue(Of String)(NameOf(PersistentClass1.PersistentProperty1A), _PersistentProperty1A, value) 23 | End Set 24 | End Property 25 | 26 | Private _PersistentProperty1B As String 27 | 28 | Public Property PersistentProperty1B As String 29 | Get 30 | Return _PersistentProperty1B 31 | End Get 32 | 33 | Set(ByVal value As String) 34 | SetPropertyValue(Of String)(NameOf(PersistentClass1.PersistentProperty1B), _PersistentProperty1B, value) 35 | End Set 36 | End Property 37 | End Class 38 | End Namespace 39 | -------------------------------------------------------------------------------- /VB/ClassLibrary1/Properties/AssemblyInfo.vb: -------------------------------------------------------------------------------- 1 | Imports System.Reflection 2 | Imports System.Runtime.InteropServices 3 | 4 | ' General Information about an assembly is controlled through the following 5 | ' set of attributes. Change these attribute values to modify the information 6 | ' associated with an assembly. 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | ' Setting ComVisible to false makes the types in this assembly not visible 16 | ' to COM components. If you need to access a type in this assembly from 17 | ' COM, set the ComVisible attribute to true on that type. 18 | 19 | ' The following GUID is for the ID of the typelib if this project is exposed to COM 20 | 21 | ' Version information for an assembly consists of the following four values: 22 | ' 23 | ' Major Version 24 | ' Minor Version 25 | ' Build Number 26 | ' Revision 27 | ' 28 | ' You can specify all the values or you can default the Build and Revision Numbers 29 | ' by using the '*' as shown below: 30 | ' [assembly: AssemblyVersion("1.0.*")] 31 | 32 | 33 | -------------------------------------------------------------------------------- /VB/ClassLibrary2/PersistentClass2.vb: -------------------------------------------------------------------------------- 1 | Imports DevExpress.Xpo 2 | Imports DevExpress.Persistent.Base 3 | 4 | Namespace ClassLibrary2 5 | 6 | 7 | Public Class PersistentClass2 8 | Inherits XPObject 9 | 10 | Public Sub New(ByVal session As Session) 11 | MyBase.New(session) 12 | End Sub 13 | 14 | Private _PersistentPropertyX As String 15 | 16 | Public Property PersistentPropertyX As String 17 | Get 18 | Return _PersistentPropertyX 19 | End Get 20 | 21 | Set(ByVal value As String) 22 | SetPropertyValue(Of String)(NameOf(PersistentClass2.PersistentPropertyX), _PersistentPropertyX, value) 23 | End Set 24 | End Property 25 | End Class 26 | End Namespace 27 | -------------------------------------------------------------------------------- /VB/ClassLibrary2/Properties/AssemblyInfo.vb: -------------------------------------------------------------------------------- 1 | Imports System.Reflection 2 | Imports System.Runtime.InteropServices 3 | 4 | ' General Information about an assembly is controlled through the following 5 | ' set of attributes. Change these attribute values to modify the information 6 | ' associated with an assembly. 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | ' Setting ComVisible to false makes the types in this assembly not visible 16 | ' to COM components. If you need to access a type in this assembly from 17 | ' COM, set the ComVisible attribute to true on that type. 18 | 19 | ' The following GUID is for the ID of the typelib if this project is exposed to COM 20 | 21 | ' Version information for an assembly consists of the following four values: 22 | ' 23 | ' Major Version 24 | ' Minor Version 25 | ' Build Number 26 | ' Revision 27 | ' 28 | ' You can specify all the values or you can default the Build and Revision Numbers 29 | ' by using the '*' as shown below: 30 | ' [assembly: AssemblyVersion("1.0.*")] 31 | 32 | 33 | -------------------------------------------------------------------------------- /VB/CommonModule/BusinessObjects/ApplicationUser.vb: -------------------------------------------------------------------------------- 1 | Imports System 2 | Imports System.Collections.Generic 3 | Imports System.ComponentModel 4 | Imports System.Linq 5 | Imports DevExpress.ExpressApp 6 | Imports DevExpress.ExpressApp.Security 7 | Imports DevExpress.Persistent.BaseImpl.PermissionPolicy 8 | Imports DevExpress.Xpo 9 | 10 | Namespace CommonModule.BusinessObjects 11 | 12 | 13 | 14 | Public Class ApplicationUser 15 | Inherits PermissionPolicyUser 16 | Implements IObjectSpaceLink, ISecurityUserWithLoginInfo 17 | 18 | Public Sub New(ByVal session As Session) 19 | MyBase.New(session) 20 | End Sub 21 | 22 | 23 | 24 | Public ReadOnly Property LoginInfo As XPCollection(Of ApplicationUserLoginInfo) 25 | Get 26 | Return GetCollection(Of ApplicationUserLoginInfo)(NameOf(ApplicationUser.LoginInfo)) 27 | End Get 28 | End Property 29 | 30 | Private ReadOnly Property UserLogins As IEnumerable(Of ISecurityUserLoginInfo) Implements ISecurityUserWithLoginInfo.UserLogins 31 | Get 32 | Return LoginInfo.OfType(Of ISecurityUserLoginInfo)() 33 | End Get 34 | End Property 35 | 36 | Private Property ObjectSpace As IObjectSpace Implements IObjectSpaceLink.ObjectSpace 37 | 38 | Private Function CreateUserLoginInfo(ByVal loginProviderName As String, ByVal providerUserKey As String) As ISecurityUserLoginInfo Implements ISecurityUserWithLoginInfo.CreateUserLoginInfo 39 | Dim result As ApplicationUserLoginInfo = CType(Me, IObjectSpaceLink).ObjectSpace.CreateObject(Of ApplicationUserLoginInfo)() 40 | result.LoginProviderName = loginProviderName 41 | result.ProviderUserKey = providerUserKey 42 | result.MyUser = Me 43 | Return result 44 | End Function 45 | End Class 46 | End Namespace 47 | -------------------------------------------------------------------------------- /VB/CommonModule/BusinessObjects/ApplicationUserLoginInfo.vb: -------------------------------------------------------------------------------- 1 | Imports DevExpress.ExpressApp.ConditionalAppearance 2 | Imports DevExpress.ExpressApp.Security 3 | Imports DevExpress.Persistent.BaseImpl 4 | Imports DevExpress.Xpo 5 | 6 | Namespace CommonModule.BusinessObjects 7 | 8 | 9 | 10 | Public Class ApplicationUserLoginInfo 11 | Inherits BaseObject 12 | Implements ISecurityUserLoginInfo 13 | 14 | Private loginProviderNameField As String 15 | 16 | Private userField As ApplicationUser 17 | 18 | Private providerUserKeyField As String 19 | 20 | Public Sub New(ByVal session As Session) 21 | MyBase.New(session) 22 | End Sub 23 | 24 | 25 | 26 | Public Property LoginProviderName As String Implements ISecurityUserLoginInfo.LoginProviderName 27 | Get 28 | Return loginProviderNameField 29 | End Get 30 | 31 | Set(ByVal value As String) 32 | SetPropertyValue(NameOf(ApplicationUserLoginInfo.LoginProviderName), loginProviderNameField, value) 33 | End Set 34 | End Property 35 | 36 | 37 | Public Property ProviderUserKey As String Implements ISecurityUserLoginInfo.ProviderUserKey 38 | Get 39 | Return providerUserKeyField 40 | End Get 41 | 42 | Set(ByVal value As String) 43 | SetPropertyValue(NameOf(ApplicationUserLoginInfo.ProviderUserKey), providerUserKeyField, value) 44 | End Set 45 | End Property 46 | 47 | 48 | Public Property MyUser As ApplicationUser 49 | Get 50 | Return userField 51 | End Get 52 | 53 | Set(ByVal value As ApplicationUser) 54 | SetPropertyValue(NameOf(ApplicationUserLoginInfo.User), userField, value) 55 | End Set 56 | End Property 57 | 58 | Private ReadOnly Property User As Object Implements ISecurityUserLoginInfo.User 59 | Get 60 | Return Me.MyUser 61 | End Get 62 | End Property 63 | End Class 64 | End Namespace 65 | -------------------------------------------------------------------------------- /VB/CommonModule/Properties/AssemblyInfo.vb: -------------------------------------------------------------------------------- 1 | Imports System.Reflection 2 | Imports System.Runtime.InteropServices 3 | 4 | ' General Information about an assembly is controlled through the following 5 | ' set of attributes. Change these attribute values to modify the information 6 | ' associated with an assembly. 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | ' Setting ComVisible to false makes the types in this assembly not visible 16 | ' to COM components. If you need to access a type in this assembly from 17 | ' COM, set the ComVisible attribute to true on that type. 18 | 19 | ' The following GUID is for the ID of the typelib if this project is exposed to COM 20 | 21 | ' Version information for an assembly consists of the following four values: 22 | ' 23 | ' Major Version 24 | ' Minor Version 25 | ' Build Number 26 | ' Revision 27 | ' 28 | ' You can specify all the values or you can default the Build and Revision Numbers 29 | ' by using the '*' as shown below: 30 | ' [assembly: AssemblyVersion("1.0.*")] 31 | 32 | 33 | -------------------------------------------------------------------------------- /VB/TwoXpoModelsForDifferentDatabases.Web/Default.aspx: -------------------------------------------------------------------------------- 1 | <%@ Page Language="C#" AutoEventWireup="true" Inherits="Default" EnableViewState="false" 2 | ValidateRequest="false" CodeBehind="Default.aspx.cs" %> 3 | <%@ Register Assembly="DevExpress.ExpressApp.Web.v24.2" Namespace="DevExpress.ExpressApp.Web.Templates" 4 | TagPrefix="cc3" %> 5 | <%@ Register Assembly="DevExpress.ExpressApp.Web.v24.2" Namespace="DevExpress.ExpressApp.Web.Controls" 6 | TagPrefix="cc4" %> 7 | 8 | 9 | 10 | Main Page 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /VB/TwoXpoModelsForDifferentDatabases.Web/Default.aspx.designer.vb: -------------------------------------------------------------------------------- 1 | '------------------------------------------------------------------------------ 2 | ' 3 | ' This code was generated by a tool. 4 | ' Runtime Version:2.0.50727.5448 5 | ' 6 | ' Changes to this file may cause incorrect behavior and will be lost if 7 | ' the code is regenerated. 8 | ' 9 | '------------------------------------------------------------------------------ 10 | Public Partial Class [Default] 11 | 12 | ''' 13 | ''' form2 control. 14 | ''' 15 | ''' 16 | ''' Auto-generated field. 17 | ''' To modify move field declaration from designer file to code-behind file. 18 | ''' 19 | Protected form2 As Global.System.Web.UI.HtmlControls.HtmlForm 20 | 21 | ''' 22 | ''' UPPopupWindowControl control. 23 | ''' 24 | ''' 25 | ''' Auto-generated field. 26 | ''' To modify move field declaration from designer file to code-behind file. 27 | ''' 28 | Protected UPPopupWindowControl As Global.DevExpress.ExpressApp.Web.Templates.XafUpdatePanel 29 | 30 | ''' 31 | ''' PopupWindowControl control. 32 | ''' 33 | ''' 34 | ''' Auto-generated field. 35 | ''' To modify move field declaration from designer file to code-behind file. 36 | ''' 37 | Protected PopupWindowControl As Global.DevExpress.ExpressApp.Web.Controls.XafPopupWindowControl 38 | 39 | ''' 40 | ''' ProgressControl control. 41 | ''' 42 | ''' 43 | ''' Auto-generated field. 44 | ''' To modify move field declaration from designer file to code-behind file. 45 | ''' 46 | Protected ProgressControl As Global.DevExpress.ExpressApp.Web.Controls.ASPxProgressControl 47 | 48 | ''' 49 | ''' Content control. 50 | ''' 51 | ''' 52 | ''' Auto-generated field. 53 | ''' To modify move field declaration from designer file to code-behind file. 54 | ''' 55 | Protected Content As Global.System.Web.UI.HtmlControls.HtmlGenericControl 56 | End Class 57 | -------------------------------------------------------------------------------- /VB/TwoXpoModelsForDifferentDatabases.Web/Default.aspx.vb: -------------------------------------------------------------------------------- 1 | Imports System.Web.UI 2 | Imports DevExpress.ExpressApp.Templates 3 | Imports DevExpress.ExpressApp.Web 4 | Imports DevExpress.ExpressApp.Web.Templates 5 | Imports DevExpress.ExpressApp.Web.Templates.ActionContainers 6 | 7 | Public Partial Class [Default] 8 | Inherits BaseXafPage 9 | 10 | Protected Overrides Function CreateContextActionsMenu() As ContextActionsMenu 11 | Return New ContextActionsMenu(Me, "Edit", "RecordEdit", "ObjectsCreation", "ListView", "Reports") 12 | End Function 13 | 14 | Public Overrides ReadOnly Property InnerContentPlaceHolder As Control 15 | Get 16 | Return Content 17 | End Get 18 | End Property 19 | End Class 20 | -------------------------------------------------------------------------------- /VB/TwoXpoModelsForDifferentDatabases.Web/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Language="C#" CodeBehind="Global.asax.cs" Inherits="TwoXpoModelsForDifferentDatabases.Web.Global"%> 2 | -------------------------------------------------------------------------------- /VB/TwoXpoModelsForDifferentDatabases.Web/Login.aspx: -------------------------------------------------------------------------------- 1 | <%@ Page Language="C#" AutoEventWireup="true" Inherits="LoginPage" EnableViewState="false" CodeBehind="Login.aspx.cs" %> 2 | <%@ Register Assembly="DevExpress.ExpressApp.Web.v24.2" Namespace="DevExpress.ExpressApp.Web.Templates.ActionContainers" 3 | TagPrefix="cc2" %> 4 | <%@ Register Assembly="DevExpress.ExpressApp.Web.v24.2" Namespace="DevExpress.ExpressApp.Web.Templates.Controls" 5 | TagPrefix="tc" %> 6 | <%@ Register Assembly="DevExpress.ExpressApp.Web.v24.2" Namespace="DevExpress.ExpressApp.Web.Controls" 7 | TagPrefix="cc4" %> 8 | <%@ Register Assembly="DevExpress.ExpressApp.Web.v24.2" Namespace="DevExpress.ExpressApp.Web.Templates" 9 | TagPrefix="cc3" %> 10 | 11 | 12 | 13 | Logon 14 | 15 | 16 |
17 |
18 | 19 |
20 | 21 |
22 | 23 | 24 | -------------------------------------------------------------------------------- /VB/TwoXpoModelsForDifferentDatabases.Web/Login.aspx.designer.vb: -------------------------------------------------------------------------------- 1 | '------------------------------------------------------------------------------ 2 | ' 3 | ' This code was generated by a tool. 4 | ' Runtime Version:2.0.50727.5448 5 | ' 6 | ' Changes to this file may cause incorrect behavior and will be lost if 7 | ' the code is regenerated. 8 | ' 9 | '------------------------------------------------------------------------------ 10 | Public Partial Class LoginPage 11 | 12 | ''' 13 | ''' Head1 control. 14 | ''' 15 | ''' 16 | ''' Auto-generated field. 17 | ''' To modify move field declaration from designer file to code-behind file. 18 | ''' 19 | Protected Head1 As Global.System.Web.UI.HtmlControls.HtmlHead 20 | 21 | ''' 22 | ''' form1 control. 23 | ''' 24 | ''' 25 | ''' Auto-generated field. 26 | ''' To modify move field declaration from designer file to code-behind file. 27 | ''' 28 | Protected form1 As Global.System.Web.UI.HtmlControls.HtmlForm 29 | 30 | ''' 31 | ''' ProgressControl control. 32 | ''' 33 | ''' 34 | ''' Auto-generated field. 35 | ''' To modify move field declaration from designer file to code-behind file. 36 | ''' 37 | Protected ProgressControl As Global.DevExpress.ExpressApp.Web.Controls.ASPxProgressControl 38 | 39 | ''' 40 | ''' Content control. 41 | ''' 42 | ''' 43 | ''' Auto-generated field. 44 | ''' To modify move field declaration from designer file to code-behind file. 45 | ''' 46 | Protected Content As Global.System.Web.UI.HtmlControls.HtmlGenericControl 47 | End Class 48 | -------------------------------------------------------------------------------- /VB/TwoXpoModelsForDifferentDatabases.Web/Login.aspx.vb: -------------------------------------------------------------------------------- 1 | Imports System 2 | Imports DevExpress.ExpressApp.Web 3 | Imports DevExpress.ExpressApp.Web.Templates 4 | 5 | Public Partial Class LoginPage 6 | Inherits BaseXafPage 7 | 8 | Public Overrides ReadOnly Property InnerContentPlaceHolder As Web.UI.Control 9 | Get 10 | Return Content 11 | End Get 12 | End Property 13 | End Class 14 | -------------------------------------------------------------------------------- /VB/TwoXpoModelsForDifferentDatabases.Web/Model.xafml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /VB/TwoXpoModelsForDifferentDatabases.Web/Properties/AssemblyInfo.vb: -------------------------------------------------------------------------------- 1 | Imports System.Reflection 2 | Imports System.Runtime.InteropServices 3 | 4 | ' General Information about an assembly is controlled through the following 5 | ' set of attributes. Change these attribute values to modify the information 6 | ' associated with an assembly. 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | ' Setting ComVisible to false makes the types in this assembly not visible 16 | ' to COM components. If you need to access a type in this assembly from 17 | ' COM, set the ComVisible attribute to true on that type. 18 | 19 | ' The following GUID is for the ID of the typelib if this project is exposed to COM 20 | 21 | ' Version information for an assembly consists of the following four values: 22 | ' 23 | ' Major Version 24 | ' Minor Version 25 | ' Build Number 26 | ' Revision 27 | ' 28 | ' You can specify all the values or you can default the Revision and Build Numbers 29 | ' by using the '*' as shown below: 30 | 31 | 32 | -------------------------------------------------------------------------------- /VB/TwoXpoModelsForDifferentDatabases.Web/ReadMe.txt: -------------------------------------------------------------------------------- 1 | Project Description 2 | 3 | This project implements an ASP.NET application. The ApplicationCode project 4 | folder contains the WebApplication.cs(vb) file with the class that inherits 5 | WebApplication. This class can be designed with the Application Designer that 6 | allows you to view and customize application components: referenced modules, 7 | security settings, data connection. Additionally, the root folder contains 8 | Application Model difference files (XAFML files) that keep application settings 9 | specific for the current application. Differences files can be designed with 10 | the Model Editor. 11 | 12 | 13 | Relevant Documentation 14 | 15 | Application Solution Components 16 | http://help.devexpress.com/#Xaf/CustomDocument2569 17 | 18 | WebApplication Class 19 | http://help.devexpress.com/#Xaf/clsDevExpressExpressWebWebApplicationtopic 20 | 21 | XafApplication Class 22 | http://help.devexpress.com/#Xaf/clsDevExpressExpressXafApplicationtopic 23 | 24 | Application Designer 25 | http://help.devexpress.com/#Xaf/CustomDocument2827 26 | 27 | Application Model 28 | http://help.devexpress.com/#Xaf/CustomDocument2579 29 | 30 | Model Editor 31 | http://help.devexpress.com/#Xaf/CustomDocument2582 32 | 33 | 34 | eXpand Framework - http://www.expandframework.com 35 | 36 | This is an open source toolkit built above the eXpressApp Framework extending its capabilities 37 | and providing 50+ cutting-edge libraries containing tools and reusable modules to target numerous 38 | business scenarios. The main idea behind eXpand is to offer as many features as possible to 39 | developers/business users through a declarative approach (configuring files rather than writing code). 40 | -------------------------------------------------------------------------------- /VB/TwoXpoModelsForDifferentDatabases.Web/Web.Debug.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 14 | 15 | 26 | 27 | -------------------------------------------------------------------------------- /VB/TwoXpoModelsForDifferentDatabases.Web/Web.EasyTest.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 14 | 15 | 16 | 27 | 28 | -------------------------------------------------------------------------------- /VB/TwoXpoModelsForDifferentDatabases.Web/Web.Release.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 14 | 15 | 16 | 27 | 28 | -------------------------------------------------------------------------------- /VB/TwoXpoModelsForDifferentDatabases.Win/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 23 | 27 | 31 | 32 | 33 | 34 | 35 | 36 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /VB/TwoXpoModelsForDifferentDatabases.Win/ExpressApp.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevExpress-Examples/XAF_how-to-connect-different-data-models-to-several-databases-within-a-single-application/fc465de644b709506545cd9e389a77fe0ade37f5/VB/TwoXpoModelsForDifferentDatabases.Win/ExpressApp.ico -------------------------------------------------------------------------------- /VB/TwoXpoModelsForDifferentDatabases.Win/Images/ReadMe.txt: -------------------------------------------------------------------------------- 1 | Folder Description 2 | 3 | The "Images" project folder is intended for storing custom image files. 4 | 5 | 6 | Relevant Documentation 7 | 8 | Add and Override Images 9 | http://help.devexpress.com/#Xaf/CustomDocument2792 10 | 11 | Assign a Custom Image 12 | http://help.devexpress.com/#Xaf/CustomDocument2744 13 | -------------------------------------------------------------------------------- /VB/TwoXpoModelsForDifferentDatabases.Win/Model.xafml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /VB/TwoXpoModelsForDifferentDatabases.Win/Program.vb: -------------------------------------------------------------------------------- 1 | Imports System 2 | Imports System.Windows.Forms 3 | Imports DevExpress.ExpressApp 4 | Imports DevExpress.ExpressApp.Security 5 | Imports DevExpress.ExpressApp.Win 6 | Imports DevExpress.Persistent.Base 7 | Imports DevExpress.Persistent.BaseImpl 8 | 9 | Namespace TwoXpoModelsForDifferentDatabases.Win 10 | 11 | Friend Module Program 12 | 13 | ''' 14 | ''' The main entry point for the application. 15 | ''' 16 | 17 | Sub Main() 18 | DevExpress.ExpressApp.FrameworkSettings.DefaultSettingsCompatibilityMode = DevExpress.ExpressApp.FrameworkSettingsCompatibilityMode.v20_1 19 | #If EASYTEST 20 | DevExpress.ExpressApp.Win.EasyTest.EasyTestRemotingRegistration.Register(); 21 | #End If 22 | Call Application.EnableVisualStyles() 23 | Application.SetCompatibleTextRenderingDefault(False) 24 | EditModelPermission.AlwaysGranted = System.Diagnostics.Debugger.IsAttached 25 | Dim winApplication As TwoXpoModelsForDifferentDatabasesWindowsFormsApplication = New TwoXpoModelsForDifferentDatabasesWindowsFormsApplication() 26 | DevExpress.ExpressApp.Utils.ImageLoader.Instance.UseSvgImages = True 27 | winApplication.UseLightStyle = True 28 | DevExpress.ExpressApp.Utils.ImageLoader.Instance.UseSvgImages = True 29 | ' Refer to the http://documentation.devexpress.com/#Xaf/CustomDocument2680 help article for more details on how to provide a custom splash form. 30 | 'winApplication.SplashScreen = new DevExpress.ExpressApp.Win.Utils.DXSplashScreen("YourSplashImage.png"); 31 | #If EASYTEST 32 | //if(ConfigurationManager.ConnectionStrings["EasyTestConnectionString"] != null) { 33 | // winApplication.ConnectionString = ConfigurationManager.ConnectionStrings["EasyTestConnectionString"].ConnectionString; 34 | //} 35 | #End If 36 | 'if(ConfigurationManager.ConnectionStrings["ConnectionString"] != null) { 37 | ' winApplication.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; 38 | '} 39 | #If DEBUG 40 | If System.Diagnostics.Debugger.IsAttached Then 41 | winApplication.DatabaseUpdateMode = DatabaseUpdateMode.UpdateDatabaseAlways 42 | End If 43 | 44 | #End If 45 | Try 46 | winApplication.Setup() 47 | winApplication.Start() 48 | Catch e As Exception 49 | winApplication.HandleException(e) 50 | End Try 51 | End Sub 52 | End Module 53 | End Namespace 54 | -------------------------------------------------------------------------------- /VB/TwoXpoModelsForDifferentDatabases.Win/Properties/AssemblyInfo.vb: -------------------------------------------------------------------------------- 1 | Imports System.Reflection 2 | Imports System.Runtime.InteropServices 3 | 4 | ' General Information about an assembly is controlled through the following 5 | ' set of attributes. Change these attribute values to modify the information 6 | ' associated with an assembly. 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | ' Setting ComVisible to false makes the types in this assembly not visible 16 | ' to COM components. If you need to access a type in this assembly from 17 | ' COM, set the ComVisible attribute to true on that type. 18 | 19 | ' Version information for an assembly consists of the following four values: 20 | ' 21 | ' Major Version 22 | ' Minor Version 23 | ' Build Number 24 | ' Revision 25 | ' 26 | ' You can specify all the values or you can default the Revision and Build Numbers 27 | ' by using the '*' as shown below: 28 | 29 | 30 | -------------------------------------------------------------------------------- /VB/TwoXpoModelsForDifferentDatabases.Win/Properties/Settings.Designer.vb: -------------------------------------------------------------------------------- 1 | '------------------------------------------------------------------------------ 2 | ' 3 | ' This code was generated by a tool. 4 | ' Runtime Version:4.0.30319.42000 5 | ' 6 | ' Changes to this file may cause incorrect behavior and will be lost if 7 | ' the code is regenerated. 8 | ' 9 | '------------------------------------------------------------------------------ 10 | Namespace TwoXpoModelsForDifferentDatabases.Win.Properties 11 | 12 | 13 | 14 | Friend NotInheritable Partial Class Settings 15 | Inherits Global.System.Configuration.ApplicationSettingsBase 16 | 17 | Private Shared defaultInstance As TwoXpoModelsForDifferentDatabases.Win.Properties.Settings = CType((Global.System.Configuration.ApplicationSettingsBase.Synchronized(New TwoXpoModelsForDifferentDatabases.Win.Properties.Settings())), TwoXpoModelsForDifferentDatabases.Win.Properties.Settings) 18 | 19 | Public Shared ReadOnly Property [Default] As Settings 20 | Get 21 | Return TwoXpoModelsForDifferentDatabases.Win.Properties.Settings.defaultInstance 22 | End Get 23 | End Property 24 | End Class 25 | End Namespace 26 | -------------------------------------------------------------------------------- /VB/TwoXpoModelsForDifferentDatabases.Win/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /VB/TwoXpoModelsForDifferentDatabases.Win/ReadMe.txt: -------------------------------------------------------------------------------- 1 | Project Description 2 | 3 | This project implements a Windows Forms application. The root project folder 4 | contains the WinApplication.cs(vb) file with the class that inherits 5 | WinApplication. This class can be designed with the Application Designer that 6 | allows you to view and customize application components: referenced modules, 7 | security settings, data connection. Additionally, the root folder contains 8 | Application Model difference files (XAFML files) that keep application settings 9 | specific for the current application. Differences files can be designed with 10 | the Model Editor. 11 | 12 | 13 | Relevant Documentation 14 | 15 | Application Solution Components 16 | http://help.devexpress.com/#Xaf/CustomDocument2569 17 | 18 | WinApplication Class 19 | http://help.devexpress.com/#Xaf/clsDevExpressExpressWinWinApplicationtopic 20 | 21 | XafApplication Class 22 | http://help.devexpress.com/#Xaf/clsDevExpressExpressXafApplicationtopic 23 | 24 | Application Designer 25 | http://help.devexpress.com/#Xaf/CustomDocument2827 26 | 27 | Application Model 28 | http://help.devexpress.com/#Xaf/CustomDocument2579 29 | 30 | Model Editor 31 | http://help.devexpress.com/#Xaf/CustomDocument2582 32 | 33 | 34 | eXpand Framework - http://www.expandframework.com 35 | 36 | This is an open source toolkit built above the eXpressApp Framework extending its capabilities 37 | and providing 50+ cutting-edge libraries containing tools and reusable modules to target numerous 38 | business scenarios. The main idea behind eXpand is to offer as many features as possible to 39 | developers/business users through a declarative approach (configuring files rather than writing code). 40 | -------------------------------------------------------------------------------- /VB/TwoXpoModelsForDifferentDatabases.Win/WinApplication.vb: -------------------------------------------------------------------------------- 1 | Imports System 2 | Imports DevExpress.ExpressApp 3 | Imports DevExpress.ExpressApp.Win 4 | 5 | 'using DevExpress.ExpressApp.Security; 6 | Namespace TwoXpoModelsForDifferentDatabases.Win 7 | 8 | Public Partial Class TwoXpoModelsForDifferentDatabasesWindowsFormsApplication 9 | Inherits WinApplication 10 | 11 | Public Sub New() 12 | InitializeComponent() 13 | DelayedViewItemsInitialization = True 14 | End Sub 15 | 16 | Private Sub TwoXpoModelsForDifferentDatabasesWindowsFormsApplication_CustomizeLanguagesList(ByVal sender As Object, ByVal e As CustomizeLanguagesListEventArgs) 17 | Dim userLanguageName As String = Threading.Thread.CurrentThread.CurrentUICulture.Name 18 | If Not Equals(userLanguageName, "en-US") AndAlso e.Languages.IndexOf(userLanguageName) = -1 Then 19 | e.Languages.Add(userLanguageName) 20 | End If 21 | End Sub 22 | 23 | Private Sub TwoXpoModelsForDifferentDatabasesWindowsFormsApplication_DatabaseVersionMismatch(ByVal sender As Object, ByVal e As DevExpress.ExpressApp.DatabaseVersionMismatchEventArgs) 24 | #If EASYTEST 25 | e.Updater.Update(); 26 | e.Handled = true; 27 | #Else 28 | If System.Diagnostics.Debugger.IsAttached Then 29 | e.Updater.Update() 30 | e.Handled = True 31 | Else 32 | Throw New InvalidOperationException("The application cannot connect to the specified database, because the latter doesn't exist or its version is older than that of the application." & Microsoft.VisualBasic.Constants.vbCrLf & "This error occurred because the automatic database update was disabled when the application was started without debugging." & Microsoft.VisualBasic.Constants.vbCrLf & "To avoid this error, you should either start the application under Visual Studio in debug mode, or modify the " & "source code of the 'DatabaseVersionMismatch' event handler to enable automatic database update, " & "or manually create a database using the 'DBUpdater' tool." & Microsoft.VisualBasic.Constants.vbCrLf & "Anyway, refer to the 'Update Application and Database Versions' help topic at http://www.devexpress.com/Help/?document=ExpressApp/CustomDocument2795.htm " & "for more detailed information. If this doesn't help, please contact our Support Team at http://www.devexpress.com/Support/Center/") 33 | End If 34 | #End If 35 | End Sub 36 | End Class 37 | End Namespace 38 | -------------------------------------------------------------------------------- /config.json: -------------------------------------------------------------------------------- 1 | { 2 | "runOnWeb": false, 3 | "autoGenerateVb": false 4 | } 5 | -------------------------------------------------------------------------------- /media/95572a4e-4ac0-4852-bdd4-de411b72df28.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevExpress-Examples/XAF_how-to-connect-different-data-models-to-several-databases-within-a-single-application/fc465de644b709506545cd9e389a77fe0ade37f5/media/95572a4e-4ac0-4852-bdd4-de411b72df28.png --------------------------------------------------------------------------------