mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2026-06-13 14:38:43 +00:00
up
This commit is contained in:
@@ -44,7 +44,7 @@ public abstract class PacketFilter : IResource
|
||||
public event DestroyedEvent OnDestroy;
|
||||
|
||||
|
||||
public abstract AsyncReply<bool> Trigger(ResourceTrigger trigger);
|
||||
public abstract AsyncReply<bool> Handle(ResourceOperation trigger);
|
||||
|
||||
public abstract bool Execute(Packet packet);
|
||||
|
||||
|
||||
@@ -67,36 +67,22 @@ public class PacketServer : IResource
|
||||
OnDestroy?.Invoke(this);
|
||||
}
|
||||
|
||||
public AsyncReply<bool> Trigger(ResourceTrigger trigger)
|
||||
public AsyncReply<bool> Trigger(ResourceOperation trigger)
|
||||
{
|
||||
if (trigger == ResourceTrigger.Initialize)
|
||||
if (trigger == ResourceOperation.Initialize)
|
||||
{
|
||||
/*
|
||||
foreach (var resource in Instance.Children<IResource>())
|
||||
{
|
||||
|
||||
if (resource is PacketFilter)
|
||||
{
|
||||
filters.Add(resource as PacketFilter);
|
||||
}
|
||||
else if (resource is PacketSource)
|
||||
{
|
||||
sources.Add(resource as PacketSource);
|
||||
}
|
||||
}
|
||||
*/
|
||||
foreach (var src in sources)
|
||||
{
|
||||
src.OnNewPacket += PacketReceived;
|
||||
src.Open();
|
||||
}
|
||||
}
|
||||
else if (trigger == ResourceTrigger.Terminate)
|
||||
else if (trigger == ResourceOperation.Terminate)
|
||||
{
|
||||
// foreach (var src in sources)
|
||||
// src.Close();
|
||||
foreach (var src in sources)
|
||||
src.Close();
|
||||
}
|
||||
else if (trigger == ResourceTrigger.SystemReload)
|
||||
else if (trigger == ResourceOperation.SystemReload)
|
||||
{
|
||||
foreach (var src in sources)
|
||||
{
|
||||
|
||||
@@ -44,7 +44,7 @@ public abstract class PacketSource : IResource
|
||||
}
|
||||
|
||||
|
||||
public abstract AsyncReply<bool> Trigger(ResourceTrigger trigger);
|
||||
public abstract AsyncReply<bool> Trigger(ResourceOperation trigger);
|
||||
|
||||
|
||||
public abstract bool RawMode
|
||||
|
||||
@@ -30,7 +30,7 @@ public class EpOverHttp : HttpFilter
|
||||
return new AsyncReply<bool>(true);
|
||||
}
|
||||
|
||||
public override AsyncReply<bool> Trigger(ResourceTrigger trigger)
|
||||
public override AsyncReply<bool> Trigger(ResourceOperation trigger)
|
||||
{
|
||||
return new AsyncReply<bool>(true);
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public class EpOvwerWebsocket : HttpFilter
|
||||
|
||||
}
|
||||
|
||||
public override AsyncReply<bool> Trigger(ResourceTrigger trigger)
|
||||
public override AsyncReply<bool> Trigger(ResourceOperation trigger)
|
||||
{
|
||||
return new AsyncReply<bool>(true);
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public abstract class HttpFilter : IResource
|
||||
}
|
||||
|
||||
public event DestroyedEvent OnDestroy;
|
||||
public abstract AsyncReply<bool> Trigger(ResourceTrigger trigger);
|
||||
public abstract AsyncReply<bool> Trigger(ResourceOperation trigger);
|
||||
|
||||
/*
|
||||
public virtual void SessionModified(HTTPSession session, string key, object oldValue, object newValue)
|
||||
|
||||
@@ -291,10 +291,10 @@ public class HttpServer : NetworkServer<HttpConnection>, IResource
|
||||
*/
|
||||
|
||||
|
||||
public async AsyncReply<bool> Trigger(ResourceTrigger trigger)
|
||||
public async AsyncReply<bool> Trigger(ResourceOperation trigger)
|
||||
{
|
||||
|
||||
if (trigger == ResourceTrigger.Initialize)
|
||||
if (trigger == ResourceOperation.Initialize)
|
||||
{
|
||||
//var ip = (IPAddress)Instance.Attributes["ip"];
|
||||
//var port = (int)Instance.Attributes["port"];
|
||||
@@ -318,16 +318,16 @@ public class HttpServer : NetworkServer<HttpConnection>, IResource
|
||||
|
||||
Start(listener);
|
||||
}
|
||||
else if (trigger == ResourceTrigger.Terminate)
|
||||
else if (trigger == ResourceOperation.Terminate)
|
||||
{
|
||||
Stop();
|
||||
}
|
||||
else if (trigger == ResourceTrigger.SystemReload)
|
||||
else if (trigger == ResourceOperation.SystemReload)
|
||||
{
|
||||
await Trigger(ResourceTrigger.Terminate);
|
||||
await Trigger(ResourceTrigger.Initialize);
|
||||
await Trigger(ResourceOperation.Terminate);
|
||||
await Trigger(ResourceOperation.Initialize);
|
||||
}
|
||||
else if (trigger == ResourceTrigger.SystemInitialized)
|
||||
else if (trigger == ResourceOperation.SystemInitialized)
|
||||
{
|
||||
filters = await Instance.Children<HttpFilter>();
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ namespace Esiur.Net.Sockets
|
||||
|
||||
}
|
||||
|
||||
public bool Trigger(ResourceTrigger trigger)
|
||||
public bool Trigger(ResourceOperation trigger)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -450,7 +450,7 @@ public class SSLSocket : ISocket
|
||||
}
|
||||
}
|
||||
|
||||
public bool Trigger(ResourceTrigger trigger)
|
||||
public bool Trigger(ResourceOperation trigger)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ public class WSocket : ISocket, INetworkReceiver<ISocket>
|
||||
return sock.Begin();
|
||||
}
|
||||
|
||||
public bool Trigger(ResourceTrigger trigger)
|
||||
public bool Trigger(ResourceOperation trigger)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public abstract class TcpFilter : IResource
|
||||
public event DestroyedEvent OnDestroy;
|
||||
|
||||
|
||||
public abstract AsyncReply<bool> Trigger(ResourceTrigger trigger);
|
||||
public abstract AsyncReply<bool> Trigger(ResourceOperation trigger);
|
||||
|
||||
public virtual bool Connected(TcpConnection sender)
|
||||
{
|
||||
|
||||
@@ -66,9 +66,9 @@ public class TcpServer : NetworkServer<TcpConnection>, IResource
|
||||
|
||||
TcpFilter[] filters = null;
|
||||
|
||||
public AsyncReply<bool> Trigger(ResourceTrigger trigger)
|
||||
public AsyncReply<bool> Trigger(ResourceOperation trigger)
|
||||
{
|
||||
if (trigger == ResourceTrigger.Initialize)
|
||||
if (trigger == ResourceOperation.Initialize)
|
||||
{
|
||||
TcpSocket listener;
|
||||
|
||||
@@ -82,16 +82,16 @@ public class TcpServer : NetworkServer<TcpConnection>, IResource
|
||||
|
||||
|
||||
}
|
||||
else if (trigger == ResourceTrigger.Terminate)
|
||||
else if (trigger == ResourceOperation.Terminate)
|
||||
{
|
||||
Stop();
|
||||
}
|
||||
else if (trigger == ResourceTrigger.SystemReload)
|
||||
else if (trigger == ResourceOperation.SystemReload)
|
||||
{
|
||||
Trigger(ResourceTrigger.Terminate);
|
||||
Trigger(ResourceTrigger.Initialize);
|
||||
Trigger(ResourceOperation.Terminate);
|
||||
Trigger(ResourceOperation.Initialize);
|
||||
}
|
||||
else if (trigger == ResourceTrigger.SystemInitialized)
|
||||
else if (trigger == ResourceOperation.SystemInitialized)
|
||||
{
|
||||
Instance.Children<TcpFilter>().Then(x => filters = x);
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public abstract class UdpFilter : IResource
|
||||
|
||||
public event DestroyedEvent OnDestroy;
|
||||
|
||||
public abstract AsyncReply<bool> Trigger(ResourceTrigger trigger);
|
||||
public abstract AsyncReply<bool> Trigger(ResourceOperation trigger);
|
||||
|
||||
public abstract bool Execute(byte[] data, IPEndPoint sender);
|
||||
|
||||
|
||||
@@ -177,9 +177,9 @@ public class UdpServer : IResource
|
||||
OnDestroy?.Invoke(this);
|
||||
}
|
||||
|
||||
async AsyncReply<bool> IResource.Trigger(ResourceTrigger trigger)
|
||||
async AsyncReply<bool> IResource.Trigger(ResourceOperation trigger)
|
||||
{
|
||||
if (trigger == ResourceTrigger.Initialize)
|
||||
if (trigger == ResourceOperation.Initialize)
|
||||
{
|
||||
var address = IP == null ? IPAddress.Any : IPAddress.Parse(IP);
|
||||
|
||||
@@ -188,12 +188,12 @@ public class UdpServer : IResource
|
||||
receiver = new Thread(Receiving);
|
||||
receiver.Start();
|
||||
}
|
||||
else if (trigger == ResourceTrigger.Terminate)
|
||||
else if (trigger == ResourceOperation.Terminate)
|
||||
{
|
||||
if (receiver != null)
|
||||
receiver.Abort();
|
||||
}
|
||||
else if (trigger == ResourceTrigger.SystemInitialized)
|
||||
else if (trigger == ResourceOperation.SystemInitialized)
|
||||
{
|
||||
filters = await Instance.Children<UdpFilter>();
|
||||
}
|
||||
|
||||
@@ -1694,13 +1694,13 @@ public partial class EpConnection : NetworkConnection, IStore
|
||||
/// </summary>
|
||||
/// <param name="trigger">Resource trigger.</param>
|
||||
/// <returns></returns>
|
||||
public AsyncReply<bool> Trigger(ResourceTrigger trigger)
|
||||
public AsyncReply<bool> Trigger(ResourceOperation trigger)
|
||||
{
|
||||
|
||||
_authPacket = new EpAuthPacket(Instance.Warehouse);
|
||||
_packet = new EpPacket(Instance.Warehouse);
|
||||
|
||||
if (trigger == ResourceTrigger.Open)
|
||||
if (trigger == ResourceOperation.Open)
|
||||
{
|
||||
// @TODO: Need a better way to check for initiator or responder
|
||||
if (this.Server != null)
|
||||
|
||||
@@ -475,10 +475,10 @@ public class EpResource : DynamicObject, IResource, INotifyPropertyChanged, IDyn
|
||||
/// </summary>
|
||||
/// <param name="trigger"></param>
|
||||
/// <returns></returns>
|
||||
public AsyncReply<bool> Trigger(ResourceTrigger trigger)
|
||||
public AsyncReply<bool> Handle(ResourceOperation trigger)
|
||||
{
|
||||
|
||||
if (trigger == ResourceTrigger.Initialize)
|
||||
if (trigger == ResourceOperation.Initialize)
|
||||
{
|
||||
this.Instance.PropertyModified += (x) =>
|
||||
this.PropertyChanged?.Invoke(this, new ResourcePropertyChangedEventArgs(x.Name));
|
||||
|
||||
@@ -124,9 +124,9 @@ public class EpServer : NetworkServer<EpConnection>, IResource
|
||||
}
|
||||
|
||||
|
||||
public AsyncReply<bool> Trigger(ResourceTrigger trigger)
|
||||
public AsyncReply<bool> Trigger(ResourceOperation trigger)
|
||||
{
|
||||
if (trigger == ResourceTrigger.Initialize)
|
||||
if (trigger == ResourceOperation.Initialize)
|
||||
{
|
||||
TcpSocket listener;
|
||||
|
||||
@@ -137,14 +137,14 @@ public class EpServer : NetworkServer<EpConnection>, IResource
|
||||
|
||||
Start(listener);
|
||||
}
|
||||
else if (trigger == ResourceTrigger.Terminate)
|
||||
else if (trigger == ResourceOperation.Terminate)
|
||||
{
|
||||
Stop();
|
||||
}
|
||||
else if (trigger == ResourceTrigger.SystemReload)
|
||||
else if (trigger == ResourceOperation.SystemReload)
|
||||
{
|
||||
Trigger(ResourceTrigger.Terminate);
|
||||
Trigger(ResourceTrigger.Initialize);
|
||||
Trigger(ResourceOperation.Terminate);
|
||||
Trigger(ResourceOperation.Initialize);
|
||||
}
|
||||
|
||||
return new AsyncReply<bool>(true);
|
||||
|
||||
@@ -35,7 +35,8 @@ public delegate bool QueryFilter<T>(T value);
|
||||
|
||||
public interface IResource : IDestructible
|
||||
{
|
||||
AsyncReply<bool> Trigger(ResourceTrigger trigger);
|
||||
AsyncReply<bool> Handle(ResourceOperation trigger);
|
||||
AsyncReply<bool> Initialize(ResourceContext resourceContext);
|
||||
|
||||
[NotMapped]
|
||||
[JsonIgnore]
|
||||
|
||||
@@ -38,9 +38,9 @@ public class Resource : IResource
|
||||
OnDestroy?.Invoke(this);
|
||||
}
|
||||
|
||||
public virtual AsyncReply<bool> Trigger(ResourceTrigger trigger)
|
||||
public virtual AsyncReply<bool> Trigger(ResourceOperation trigger)
|
||||
{
|
||||
if (trigger == ResourceTrigger.Initialize)
|
||||
if (trigger == ResourceOperation.Initialize)
|
||||
return new AsyncReply<bool>(this.Create());
|
||||
else
|
||||
return new AsyncReply<bool>(true);
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2017 Ahmed Kh. Zamil
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Esiur.Resource;
|
||||
|
||||
public enum ResourceOperation : int
|
||||
{
|
||||
/// <summary>
|
||||
/// Resource is requested to open/start its active work.
|
||||
/// </summary>
|
||||
Open = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Resource is requested to initialize.
|
||||
/// </summary>
|
||||
Initialize = 1,
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Resource configuration should be applied or refreshed.
|
||||
/// </summary>
|
||||
Configure = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Resource is requested to close/stop active work, but may remain loaded.
|
||||
/// </summary>
|
||||
Close = 3,
|
||||
|
||||
/// <summary>
|
||||
/// Resource is requested to terminate and release its resources.
|
||||
/// </summary>
|
||||
Terminate = 4,
|
||||
|
||||
/// <summary>
|
||||
/// Runtime has finished initializing the system/resource graph.
|
||||
/// Safe point for resolving dependencies on other resources.
|
||||
/// </summary>
|
||||
SystemReady = 5,
|
||||
|
||||
/// <summary>
|
||||
/// Runtime is about to reload the system or resource graph.
|
||||
/// Resource should prepare for reload.
|
||||
/// </summary>
|
||||
SystemReloading = 6,
|
||||
|
||||
/// <summary>
|
||||
/// Runtime has finished reloading the system or resource graph.
|
||||
/// Resource may rebind dependencies or refresh state.
|
||||
/// </summary>
|
||||
SystemReloaded = 7,
|
||||
|
||||
/// <summary>
|
||||
/// Runtime is preparing to shut down the system.
|
||||
/// Resource should stop background activity gracefully.
|
||||
/// </summary>
|
||||
SystemTerminating = 8,
|
||||
|
||||
/// <summary>
|
||||
/// Runtime has completed system shutdown/termination.
|
||||
/// Usually used only for final notifications.
|
||||
/// </summary>
|
||||
SystemTerminated = 8,
|
||||
|
||||
/// <summary>
|
||||
/// Resource should persist its current state if supported.
|
||||
/// </summary>
|
||||
Save = 9,
|
||||
|
||||
/// <summary>
|
||||
/// Resource should reload its state from its backing store if supported.
|
||||
/// </summary>
|
||||
Load = 10,
|
||||
|
||||
/// <summary>
|
||||
/// Resource should pause active work without releasing all resources.
|
||||
/// </summary>
|
||||
Pause = 11,
|
||||
|
||||
/// <summary>
|
||||
/// Resource should resume work after pause.
|
||||
/// </summary>
|
||||
Resume = 12
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2017 Ahmed Kh. Zamil
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Esiur.Resource;
|
||||
public enum ResourceTrigger : int
|
||||
{
|
||||
Open = 0,
|
||||
Initialize,
|
||||
Terminate,
|
||||
Configure,
|
||||
SystemInitialized,
|
||||
SystemTerminated,
|
||||
SystemReload,
|
||||
}
|
||||
@@ -38,7 +38,7 @@ public abstract class Store<T> : IStore where T : IResource
|
||||
|
||||
|
||||
|
||||
public abstract AsyncReply<bool> Trigger(ResourceTrigger trigger);
|
||||
public abstract AsyncReply<bool> Trigger(ResourceOperation trigger);
|
||||
|
||||
//public async AsyncReply<T> New(string name = null, object attributes = null, object properties = null)
|
||||
//{
|
||||
|
||||
@@ -226,7 +226,7 @@ public class Warehouse
|
||||
//IResource r;
|
||||
//if (rk.Value.TryGetTarget(out r))
|
||||
//{
|
||||
var rt = await r.Trigger(ResourceTrigger.Initialize);
|
||||
var rt = await r.Trigger(ResourceOperation.Initialize);
|
||||
//if (!rt)
|
||||
// return false;
|
||||
|
||||
@@ -239,7 +239,7 @@ public class Warehouse
|
||||
|
||||
foreach (var r in resSnap)
|
||||
{
|
||||
var rt = await r.Trigger(ResourceTrigger.SystemInitialized);
|
||||
var rt = await r.Trigger(ResourceOperation.SystemInitialized);
|
||||
if (!rt)
|
||||
{
|
||||
Global.Log("Warehouse", LogType.Warning, $"Resource failed at SystemInitialized {r.Instance.Name} [{r.Instance.Definition.Name}]");
|
||||
@@ -267,13 +267,13 @@ public class Warehouse
|
||||
if (resource.TryGetTarget(out r))
|
||||
{
|
||||
if (!(r is IStore))
|
||||
bag.Add(r.Trigger(ResourceTrigger.Terminate));
|
||||
bag.Add(r.Trigger(ResourceOperation.Terminate));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var store in _stores)
|
||||
bag.Add(store.Key.Trigger(ResourceTrigger.Terminate));
|
||||
bag.Add(store.Key.Trigger(ResourceOperation.Terminate));
|
||||
|
||||
|
||||
foreach (var resource in _resources.Values)
|
||||
@@ -282,13 +282,13 @@ public class Warehouse
|
||||
if (resource.TryGetTarget(out r))
|
||||
{
|
||||
if (!(r is IStore))
|
||||
bag.Add(r.Trigger(ResourceTrigger.SystemTerminated));
|
||||
bag.Add(r.Trigger(ResourceOperation.SystemTerminated));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach (var store in _stores)
|
||||
bag.Add(store.Key.Trigger(ResourceTrigger.SystemTerminated));
|
||||
bag.Add(store.Key.Trigger(ResourceOperation.SystemTerminated));
|
||||
|
||||
bag.Seal();
|
||||
|
||||
@@ -448,9 +448,9 @@ public class Warehouse
|
||||
|
||||
if (_warehouseIsOpen)
|
||||
{
|
||||
await resource.Trigger(ResourceTrigger.Initialize);
|
||||
await resource.Handle(ResourceOperation.Initialize);
|
||||
if (resource is IStore)
|
||||
await resource.Trigger(ResourceTrigger.Open);
|
||||
await resource.Handle(ResourceOperation.Open);
|
||||
}
|
||||
|
||||
if (resource is IStore)
|
||||
|
||||
@@ -68,7 +68,7 @@ public class MemoryStore : IStore
|
||||
}
|
||||
|
||||
|
||||
public AsyncReply<bool> Trigger(ResourceTrigger trigger)
|
||||
public AsyncReply<bool> Trigger(ResourceOperation trigger)
|
||||
{
|
||||
return new AsyncReply<bool>(true);
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public class TemporaryStore : IStore
|
||||
return new AsyncReply<IResource>(null);
|
||||
}
|
||||
|
||||
public AsyncReply<bool> Trigger(ResourceTrigger trigger)
|
||||
public AsyncReply<bool> Trigger(ResourceOperation trigger)
|
||||
{
|
||||
return new AsyncReply<bool>(true);
|
||||
}
|
||||
|
||||
@@ -223,9 +223,9 @@ public class EntityStore : IStore
|
||||
|
||||
internal DbContextOptions Options { get; set; }
|
||||
|
||||
public AsyncReply<bool> Trigger(ResourceTrigger trigger)
|
||||
public AsyncReply<bool> Trigger(ResourceOperation trigger)
|
||||
{
|
||||
if (trigger == ResourceTrigger.Initialize)// SystemInitialized && DbContext != null)
|
||||
if (trigger == ResourceOperation.Initialize)// SystemInitialized && DbContext != null)
|
||||
{
|
||||
|
||||
if (Getter == null)
|
||||
|
||||
@@ -521,10 +521,10 @@ public class MongoDBStore : IStore
|
||||
public string Collection { get; set; }
|
||||
[Attribute]
|
||||
public string Database { get; set; }
|
||||
public AsyncReply<bool> Trigger(ResourceTrigger trigger)
|
||||
public AsyncReply<bool> Trigger(ResourceOperation trigger)
|
||||
{
|
||||
|
||||
if (trigger == ResourceTrigger.Initialize)
|
||||
if (trigger == ResourceOperation.Initialize)
|
||||
{
|
||||
|
||||
var collectionName = Collection ?? "resources";
|
||||
@@ -574,7 +574,7 @@ public class MongoDBStore : IStore
|
||||
|
||||
return new AsyncReply<bool>(true);
|
||||
}
|
||||
else if (trigger == ResourceTrigger.Terminate)
|
||||
else if (trigger == ResourceOperation.Terminate)
|
||||
{
|
||||
// save all resources
|
||||
foreach (var resource in resources.Values)
|
||||
|
||||
Reference in New Issue
Block a user