2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2025-06-27 05:23:13 +00:00
This commit is contained in:
2020-02-26 03:14:22 +03:00
parent 7a21f6a928
commit fde1b1d8ad
39 changed files with 1108 additions and 502 deletions

View File

@ -11,7 +11,7 @@
<PackageProjectUrl>http://www.esyur.com</PackageProjectUrl>
<RepositoryUrl>https://github.com/esyur/esyur-dotnet/</RepositoryUrl>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Version>1.3.3</Version>
<Version>1.4.0</Version>
</PropertyGroup>
<ItemGroup>

View File

@ -51,15 +51,15 @@ namespace Esyur.Stores.MongoDB
Dictionary<string, WeakReference> resources = new Dictionary<string, WeakReference>();
[ResourceEvent]
[Public]
public event ResourceEventHanlder ResourceAdded;
[ResourceEvent]
[Public]
public event ResourceEventHanlder ResourceRemoved;
int count = 0;
[ResourceProperty]
[Public]
public virtual int Count
{
get
@ -109,7 +109,7 @@ namespace Esyur.Stores.MongoDB
return true;
}
[ResourceFunction]
[Public]
public bool Remove(IResource resource)
{
var objectId = resource.Instance.Variables["objectId"].ToString();
@ -510,11 +510,11 @@ namespace Esyur.Stores.MongoDB
throw new NotImplementedException();
}
[ResourceAttribute]
[Attribute]
public string Connection { get; set; }
[ResourceAttribute]
[Attribute]
public string Collection { get; set; }
[ResourceAttribute]
[Attribute]
public string Database { get; set; }
public AsyncReply<bool> Trigger(ResourceTrigger trigger)
{
@ -725,7 +725,7 @@ namespace Esyur.Stores.MongoDB
AsyncReply<KeyList<PropertyTemplate, PropertyValue[]>> GetRecordByAge(IResource resource, ulong fromAge, ulong toAge)
{
var properties = resource.Instance.Template.Properties.Where(x => x.Storage == StorageMode.Recordable).ToList();
var properties = resource.Instance.Template.Properties.Where(x => x.Recordable).ToList();
var reply = new AsyncReply<KeyList<PropertyTemplate, PropertyValue[]>>();
@ -751,7 +751,7 @@ namespace Esyur.Stores.MongoDB
public AsyncReply<KeyList<PropertyTemplate, PropertyValue[]>> GetRecord(IResource resource, DateTime fromDate, DateTime toDate)
{
var properties = resource.Instance.Template.Properties.Where(x => x.Storage == StorageMode.Recordable).ToList();
var properties = resource.Instance.Template.Properties.Where(x => x.Recordable).ToList();
var reply = new AsyncReply<KeyList<PropertyTemplate, PropertyValue[]>>();

View File

@ -35,13 +35,15 @@ namespace Esyur.Stores.MongoDB
{
public class MongoDBStore<T> : MongoDBStore where T:IResource
{
[ResourceFunction]
public T Create(string name, Structure values)
[Public]
public T New(string name = null, object properties = null)
{
return Warehouse.New<T>(name, this, null, null, null, null, values);
var resource = Warehouse.New<T>(name, this, null, null, null, properties);
resource.Instance.Managers.AddRange(this.Instance.Managers.ToArray());
return resource;
}
[ResourceFunction]
[Public]
public async AsyncReply<IResource[]> Slice(int index, int limit)
{
var list = await this.Instance.Children<IResource>();