Why no properties are supported? and why no events on interfaces? #803
Replies: 3 comments 2 replies
-
I am totally lost! |
Beta Was this translation helpful? Give feedback.
-
Properties are supported on serialized objects. They are not supported on marshaled interfaces because marshaled interfaces carry no data -- they are strictly remote controllers. As such, everything they do is fundamentally asynchronous. We don't support properties for the same reason we don't support synchronous methods: it would require blocking a thread for a fundamentally asynchronous operation. Events are supported on regular RPC proxy interfaces. They are not yet supported on marshalled interfaces (i.e. interfaces that are used in arguments or return values) simply because supporting them is complex and we didn't want to block the main feature (#777) on implementation of a feature that could come later separately. Several interfaces are what we call exotic types and have built-in marshalability. Any custom interfaces that you want remoted behavior instead of serialization behavior must bear the By default, anything you send in an argument or return value gets serialized. But when the type you declare (the parameter or return type, or the type of field or property inside a parameter type or return type) is an interface, your serializer had better know how to instantiate a concrete type that implements that interface at deserialization time, or it must be one of the exotic types, or attributed with |
Beta Was this translation helpful? Give feedback.
-
Also is my understanding correct that this will work (regarding events) interface IMyRpcInterface
{
event EventHandler<ChangeDetails> EmployeesChanged;
Task<List<Order>> ListOrders(int employee, string employeeid);
Task<List<Employee> ListEmployees();
Task<List<Customer> ListCustomers();
} But this one does not work or result of interface IMyRpcInterface
{
event EventHandler<ChangeDetails> EmployeesChanged;
Task<List<Order>> ListOrders(int employee, string employeeid);
Task<List<Employee> ListEmployees();
Task<List<Customer> ListCustomers();
Task<GetMyRPCInterface> GetMyRPCInterface();
} |
Beta Was this translation helpful? Give feedback.
-
Hi I am wondering why there is a restriction on properties and also events on interfaces?
I am also not quite understanding how interfaces and objects implementing them is different?
Mostly I want to know if implementing them is easy maybe I can help there....
Beta Was this translation helpful? Give feedback.
All reactions