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
{
///
/// Provides methods to obtain the relevant IUnitOfWorkFactory.
///
public static class UnitOfWorkSource
{
///
/// Returns the IUnitOfWorkFactory implementation based on the current mode (run-time or design-time).
///
public static IUnitOfWorkFactory GetUnitOfWorkFactory()
{
return GetUnitOfWorkFactory(ViewModelBase.IsInDesignMode);
}
///
/// Returns the IUnitOfWorkFactory implementation based on the given mode (run-time or design-time).
///
/// Used to determine which implementation of IUnitOfWorkFactory should be returned.
public static IUnitOfWorkFactory GetUnitOfWorkFactory(bool isInDesignTime)
{
//if (isInDesignTime)
// return new DesignTimeUnitOfWorkFactory(() => new DevAVDbDesignTimeUnitOfWork());
return new DbUnitOfWorkFactory(() => new DevAVDbUnitOfWork(() => new DevAVDb(@"Data Source=devav.sqlite3")));
}
}
}