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

Resource Proxy

This commit is contained in:
2019-07-23 06:22:24 +03:00
parent 2d9f61c0d9
commit a2f4238933
12 changed files with 238 additions and 23 deletions

View File

@ -9,7 +9,7 @@ using System.Text;
namespace Test
{
class MyMembership : IMembership
public class MyMembership : IMembership
{
public Instance Instance { get; set; }

View File

@ -9,14 +9,14 @@ using System.Threading;
namespace Test
{
class MyObject : Resource
public class MyObject : Resource
{
[ResourceEvent]
public event ResourceEventHanlder LevelUp;
[ResourceEvent]
public event ResourceEventHanlder LevelDown;
public MyObject()
{
Info = new Structure();
@ -27,7 +27,7 @@ namespace Test
Level = 5;
}
[ResourceFunction]
public int Add(int value)
{
@ -113,6 +113,7 @@ namespace Test
}
}
/*
int level;
[ResourceProperty]
public int Level
@ -124,6 +125,21 @@ namespace Test
Instance?.Modified();
}
}
*/
[ResourceProperty]
public virtual int Level
{
get;
set;
}
[ResourceProperty]
public int Level3
{
get => 0;
set => Instance?.Modified();
}
}

View File

@ -41,12 +41,13 @@ namespace Test
{
static MyObject myObject;
static DistributedResource remoteObject;
static async Task Main(string[] args)
{
//AsyncContext.Run(() => ());
// Create stores to keep objects.
@ -85,6 +86,11 @@ namespace Test
else
myObject =(MyObject) (await Warehouse.Get("db/my"));//.Then((o) => { myObject = (MyObject)o; });
//var obj = ProxyObject.<MyObject>();
//Warehouse.Put(obj, "dd", system);
//obj.Level2= 33;
// Create new distributed server object
var iip = Warehouse.New<DistributedServer>("iip", system);
// Set membership which handles authentication.
@ -136,7 +142,10 @@ namespace Test
running = false;
});
else
Console.WriteLine(myObject.Name + " " + myObject.Level);
{
myObject.Level = 88;
Console.WriteLine(myObject.Name + " " + myObject.Level );
}
}