mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2025-06-26 21:13:13 +00:00
2.2
This commit is contained in:
@ -39,6 +39,11 @@ public class EntityStore : IStore
|
||||
{
|
||||
public Instance Instance { get; set; }
|
||||
|
||||
bool initialized = false;
|
||||
|
||||
|
||||
public bool Initialized => initialized;
|
||||
|
||||
public event DestroyedEvent OnDestroy;
|
||||
|
||||
Dictionary<Type, Dictionary<object, WeakReference>> DB = new Dictionary<Type, Dictionary<object, WeakReference>>();
|
||||
@ -92,6 +97,9 @@ public class EntityStore : IStore
|
||||
|
||||
public IResource GetById(Type type, object id)
|
||||
{
|
||||
if (!initialized)
|
||||
throw new Exception("Store not initalized. Make sure the Warehouse is open.");
|
||||
|
||||
lock (DBLock)
|
||||
{
|
||||
if (!DB[type].ContainsKey(id))
|
||||
@ -136,13 +144,13 @@ public class EntityStore : IStore
|
||||
return this.Instance.Name + "/" + type.Name;
|
||||
}
|
||||
|
||||
public bool Record(IResource resource, string propertyName, object value, ulong age, DateTime dateTime)
|
||||
public bool Record(IResource resource, string propertyName, object value, ulong? age, DateTime? dateTime)
|
||||
{
|
||||
return true;
|
||||
//throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool Modify(IResource resource, string propertyName, object value, ulong age, DateTime dateTime)
|
||||
public bool Modify(IResource resource, string propertyName, object value, ulong? age, DateTime? dateTime)
|
||||
{
|
||||
return true;
|
||||
//throw new NotImplementedException();
|
||||
@ -201,6 +209,8 @@ public class EntityStore : IStore
|
||||
|
||||
|
||||
ReloadModel();
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
return new AsyncReply<bool>(true);
|
||||
|
@ -9,7 +9,7 @@
|
||||
<Product>Esiur Entity Framework Extension</Product>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
<PackageId>Esiur.Stores.EntityCore</PackageId>
|
||||
<Version>1.2.5</Version>
|
||||
<Version>1.2.9</Version>
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.1" />
|
||||
<PackageReference Include="System.Collections" Version="4.3.0" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -54,6 +54,8 @@ public static class EsiurExtensions
|
||||
{
|
||||
var store = dbSet.GetInfrastructure().GetService<IDbContextOptions>().FindExtension<EsiurExtensionOptions>().Store;
|
||||
|
||||
if (!store.Initialized)
|
||||
throw new Exception("Store not initialized. Make sure the Warehouse is open");
|
||||
|
||||
var manager = store.Instance.Managers.FirstOrDefault();// > 0 ? store.Instance.Managers.First() : null;
|
||||
|
||||
@ -75,7 +77,7 @@ public static class EsiurExtensions
|
||||
else
|
||||
{
|
||||
res = Activator.CreateInstance(proxyType) as IResource;
|
||||
var ps = Structure.FromObject(resource);
|
||||
var ps = Map<string,object>.FromObject(resource);
|
||||
|
||||
foreach (var p in ps)
|
||||
{
|
||||
|
Reference in New Issue
Block a user