mirror of
https://github.com/DevExpress/netcore-winforms-demos.git
synced 2026-01-05 16:26:09 +00:00
Add Outlook Inspired and Stock Market demos
This commit is contained in:
@@ -0,0 +1,102 @@
|
||||
using DevExpress.DevAV;
|
||||
using DevExpress.Mvvm.DataModel;
|
||||
using DevExpress.Mvvm.DataModel.EFCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace DevExpress.DevAV.DevAVDbDataModel
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// A DevAVDbUnitOfWork instance that represents the run-time implementation of the IDevAVDbUnitOfWork interface.
|
||||
/// </summary>
|
||||
public class DevAVDbUnitOfWork : DbUnitOfWork<DevAVDb>, IDevAVDbUnitOfWork
|
||||
{
|
||||
|
||||
public DevAVDbUnitOfWork(Func<DevAVDb> contextFactory)
|
||||
: base(contextFactory)
|
||||
{
|
||||
}
|
||||
|
||||
IRepository<TaskAttachedFile, long> IDevAVDbUnitOfWork.AttachedFiles {
|
||||
get { return GetRepository(x => x.Set<TaskAttachedFile>(), (TaskAttachedFile x) => x.Id); }
|
||||
}
|
||||
|
||||
IRepository<EmployeeTask, long> IDevAVDbUnitOfWork.Tasks {
|
||||
get { return GetRepository(x => x.Set<EmployeeTask>(), (EmployeeTask x) => x.Id); }
|
||||
}
|
||||
|
||||
IRepository<Employee, long> IDevAVDbUnitOfWork.Employees {
|
||||
get { return GetRepository(x => x.Set<Employee>(), (Employee x) => x.Id); }
|
||||
}
|
||||
|
||||
IRepository<CustomerCommunication, long> IDevAVDbUnitOfWork.Communications {
|
||||
get { return GetRepository(x => x.Set<CustomerCommunication>(), (CustomerCommunication x) => x.Id); }
|
||||
}
|
||||
|
||||
IRepository<CustomerEmployee, long> IDevAVDbUnitOfWork.CustomerEmployees {
|
||||
get { return GetRepository(x => x.Set<CustomerEmployee>(), (CustomerEmployee x) => x.Id); }
|
||||
}
|
||||
|
||||
IRepository<Customer, long> IDevAVDbUnitOfWork.Customers {
|
||||
get { return GetRepository(x => x.Set<Customer>(), (Customer x) => x.Id); }
|
||||
}
|
||||
|
||||
IRepository<CustomerStore, long> IDevAVDbUnitOfWork.CustomerStores {
|
||||
get { return GetRepository(x => x.Set<CustomerStore>(), (CustomerStore x) => x.Id); }
|
||||
}
|
||||
|
||||
IRepository<Crest, long> IDevAVDbUnitOfWork.Crests {
|
||||
get { return GetRepository(x => x.Set<Crest>(), (Crest x) => x.Id); }
|
||||
}
|
||||
|
||||
IRepository<Order, long> IDevAVDbUnitOfWork.Orders {
|
||||
get { return GetRepository(x => x.Set<Order>(), (Order x) => x.Id); }
|
||||
}
|
||||
|
||||
IRepository<OrderItem, long> IDevAVDbUnitOfWork.OrderItems {
|
||||
get { return GetRepository(x => x.Set<OrderItem>(), (OrderItem x) => x.Id); }
|
||||
}
|
||||
|
||||
IRepository<Product, long> IDevAVDbUnitOfWork.Products {
|
||||
get { return GetRepository(x => x.Set<Product>(), (Product x) => x.Id); }
|
||||
}
|
||||
|
||||
IRepository<ProductCatalog, long> IDevAVDbUnitOfWork.ProductCatalogs {
|
||||
get { return GetRepository(x => x.Set<ProductCatalog>(), (ProductCatalog x) => x.Id); }
|
||||
}
|
||||
|
||||
IRepository<ProductImage, long> IDevAVDbUnitOfWork.ProductImages {
|
||||
get { return GetRepository(x => x.Set<ProductImage>(), (ProductImage x) => x.Id); }
|
||||
}
|
||||
|
||||
IRepository<Picture, long> IDevAVDbUnitOfWork.Pictures {
|
||||
get { return GetRepository(x => x.Set<Picture>(), (Picture x) => x.Id); }
|
||||
}
|
||||
|
||||
IRepository<QuoteItem, long> IDevAVDbUnitOfWork.QuoteItems {
|
||||
get { return GetRepository(x => x.Set<QuoteItem>(), (QuoteItem x) => x.Id); }
|
||||
}
|
||||
|
||||
IRepository<Quote, long> IDevAVDbUnitOfWork.Quotes {
|
||||
get { return GetRepository(x => x.Set<Quote>(), (Quote x) => x.Id); }
|
||||
}
|
||||
|
||||
IRepository<Evaluation, long> IDevAVDbUnitOfWork.Evaluations {
|
||||
get { return GetRepository(x => x.Set<Evaluation>(), (Evaluation x) => x.Id); }
|
||||
}
|
||||
|
||||
IRepository<Probation, long> IDevAVDbUnitOfWork.Probations {
|
||||
get { return GetRepository(x => x.Set<Probation>(), (Probation x) => x.Id); }
|
||||
}
|
||||
|
||||
IRepository<State, StateEnum> IDevAVDbUnitOfWork.States {
|
||||
get { return GetRepository(x => x.Set<State>(), (State x) => x.ShortName); }
|
||||
}
|
||||
|
||||
IRepository<DatabaseVersion, long> IDevAVDbUnitOfWork.Version {
|
||||
get { return GetRepository(x => x.Set<DatabaseVersion>(), (DatabaseVersion x) => x.Id); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
using DevExpress.DevAV;
|
||||
using DevExpress.Mvvm.DataModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace DevExpress.DevAV.DevAVDbDataModel
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// IDevAVDbUnitOfWork extends the IUnitOfWork interface with repositories representing specific entities.
|
||||
/// </summary>
|
||||
public interface IDevAVDbUnitOfWork : IUnitOfWork
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// The TaskAttachedFile entities repository.
|
||||
/// </summary>
|
||||
IRepository<TaskAttachedFile, long> AttachedFiles { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The EmployeeTask entities repository.
|
||||
/// </summary>
|
||||
IRepository<EmployeeTask, long> Tasks { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The Employee entities repository.
|
||||
/// </summary>
|
||||
IRepository<Employee, long> Employees { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The CustomerCommunication entities repository.
|
||||
/// </summary>
|
||||
IRepository<CustomerCommunication, long> Communications { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The CustomerEmployee entities repository.
|
||||
/// </summary>
|
||||
IRepository<CustomerEmployee, long> CustomerEmployees { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The Customer entities repository.
|
||||
/// </summary>
|
||||
IRepository<Customer, long> Customers { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The CustomerStore entities repository.
|
||||
/// </summary>
|
||||
IRepository<CustomerStore, long> CustomerStores { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The Crest entities repository.
|
||||
/// </summary>
|
||||
IRepository<Crest, long> Crests { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The Order entities repository.
|
||||
/// </summary>
|
||||
IRepository<Order, long> Orders { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The OrderItem entities repository.
|
||||
/// </summary>
|
||||
IRepository<OrderItem, long> OrderItems { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The Product entities repository.
|
||||
/// </summary>
|
||||
IRepository<Product, long> Products { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The ProductCatalog entities repository.
|
||||
/// </summary>
|
||||
IRepository<ProductCatalog, long> ProductCatalogs { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The ProductImage entities repository.
|
||||
/// </summary>
|
||||
IRepository<ProductImage, long> ProductImages { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The Picture entities repository.
|
||||
/// </summary>
|
||||
IRepository<Picture, long> Pictures { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The QuoteItem entities repository.
|
||||
/// </summary>
|
||||
IRepository<QuoteItem, long> QuoteItems { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The Quote entities repository.
|
||||
/// </summary>
|
||||
IRepository<Quote, long> Quotes { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The Evaluation entities repository.
|
||||
/// </summary>
|
||||
IRepository<Evaluation, long> Evaluations { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The Probation entities repository.
|
||||
/// </summary>
|
||||
IRepository<Probation, long> Probations { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The State entities repository.
|
||||
/// </summary>
|
||||
IRepository<State, StateEnum> States { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The DatabaseVersion entities repository.
|
||||
/// </summary>
|
||||
IRepository<DatabaseVersion, long> Version { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using DevExpress.DevAV;
|
||||
using DevExpress.Mvvm;
|
||||
using DevExpress.Mvvm.DataModel;
|
||||
using DevExpress.Mvvm.DataModel.DesignTime;
|
||||
using DevExpress.Mvvm.DataModel.EFCore;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
|
||||
namespace DevExpress.DevAV.DevAVDbDataModel
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Provides methods to obtain the relevant IUnitOfWorkFactory.
|
||||
/// </summary>
|
||||
public static class UnitOfWorkSource
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Returns the IUnitOfWorkFactory implementation based on the current mode (run-time or design-time).
|
||||
/// </summary>
|
||||
public static IUnitOfWorkFactory<IDevAVDbUnitOfWork> GetUnitOfWorkFactory()
|
||||
{
|
||||
return GetUnitOfWorkFactory(ViewModelBase.IsInDesignMode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the IUnitOfWorkFactory implementation based on the given mode (run-time or design-time).
|
||||
/// </summary>
|
||||
/// <param name="isInDesignTime">Used to determine which implementation of IUnitOfWorkFactory should be returned.</param>
|
||||
public static IUnitOfWorkFactory<IDevAVDbUnitOfWork> GetUnitOfWorkFactory(bool isInDesignTime)
|
||||
{
|
||||
//if (isInDesignTime)
|
||||
// return new DesignTimeUnitOfWorkFactory<IDevAVDbUnitOfWork>(() => new DevAVDbDesignTimeUnitOfWork());
|
||||
return new DbUnitOfWorkFactory<IDevAVDbUnitOfWork>(() => new DevAVDbUnitOfWork(() => new DevAVDb(@"Data Source=devav.sqlite3")));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user