2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2025-06-26 21:13:13 +00:00

GC bug fix

This commit is contained in:
2019-11-20 13:19:31 +03:00
parent 76bcd821b5
commit 7de6354857
22 changed files with 442 additions and 236 deletions

View File

@ -388,12 +388,15 @@ namespace Esiur.Resource
#endif
*/
IResource res;
if (resource.TryGetTarget(out res))
{
var rt = pt.Info.GetValue(res, null);
props.Add(new PropertyValue(rt, ages[pt.Index], modificationDates[pt.Index]));
}
//if (pt.Serilize)
//{
IResource res;
if (resource.TryGetTarget(out res))
{
var rt = pt.Serilize ? pt.Info.GetValue(res, null) : null;
props.Add(new PropertyValue(rt, ages[pt.Index], modificationDates[pt.Index]));
}
//}
}
return props.ToArray();

View File

@ -35,6 +35,7 @@ namespace Esiur.Resource
[AttributeUsage(AttributeTargets.Property)]
public class ResourceProperty : System.Attribute
{
bool serialize;
string readExpansion;
string writeExpansion;
// bool recordable;
@ -47,6 +48,8 @@ namespace Esiur.Resource
public StorageMode Storage => storage;
public bool Serialize => serialize;
public string ReadExpansion
{
get
@ -63,11 +66,12 @@ namespace Esiur.Resource
}
}
public ResourceProperty(StorageMode storage = StorageMode.NonVolatile, string readExpansion = null, string writeExpansion = null)
public ResourceProperty(StorageMode storage = StorageMode.NonVolatile, bool serialize = true, string readExpansion = null, string writeExpansion = null)
{
this.readExpansion = readExpansion;
this.writeExpansion = writeExpansion;
this.storage = storage;
this.serialize = serialize;
}
}
}

View File

@ -24,6 +24,10 @@ namespace Esiur.Resource.Template
set;
}
public bool Serilize
{
get;set;
}
//bool ReadOnly;
//IIPTypes::DataType ReturnType;
public PropertyPermission Permission {

View File

@ -161,6 +161,7 @@ namespace Esiur.Resource.Template
{
var pt = new PropertyTemplate(this, i++, pi.Name, ps[0].ReadExpansion, ps[0].WriteExpansion, ps[0].Storage);
pt.Info = pi;
pt.Serilize = ps[0].Serialize;
properties.Add(pt);
}
}

View File

@ -84,7 +84,7 @@ namespace Esiur.Resource
/// </summary>
/// <param name="id">Instance Id</param>
/// <returns></returns>
public static AsyncReply<IResource> Get(uint id)
public static AsyncReply<IResource> GetById(uint id)
{
if (resources.ContainsKey(id))
{
@ -317,9 +317,6 @@ namespace Esiur.Resource
/// <returns>Resource instance.</returns>
public static AsyncReply<IResource> Get(string path, object attributes = null, IResource parent = null, IPermissionsManager manager = null)
{
var rt = new AsyncReply<IResource>();
// Should we create a new store ?
@ -528,7 +525,7 @@ namespace Esiur.Resource
var toBeRemoved = resources.Values.Where(x => {
IResource r;
return x.TryGetTarget(out r) && r.Instance.Store == resource;
});
}).ToArray();
foreach (var o in toBeRemoved)
{