[
https://issues.apache.org/jira/browse/IGNITE-3102?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Pavel Tupitsyn updated IGNITE-3102:
-----------------------------------
Description:
Currently we create user objects with FormatterServices.GetUninitializedObject
and then call user-defined IBinarizable.ReadBinary method.
This is not convenient both for us and the user:
* FormatterServices.GetUninitializedObject is not a clean way of constructing
objects
* User-defined constructor does not get called
* User types can't have readonly fields
For example, ISerializable mechanism does not have Read method; it calls
user-defined constructor instead. We should provide similar mechanism.
* To maintain compatibility, we may have to introduce a new interface with a
single Write method, and call user-defined ctor on read.
* Another option is to introduce a [BinarizableInit] attribute. User can place
it on a constructor, and Ignite will call it, injecting Reader and Ignite
instances to parameters (if there are any).
was:
Currently we create user objects with FormatterServices.GetUninitializedObject
and then call user-defined IBinarizable.ReadBinary method.
This is not convenient both for us and the user:
* FormatterServices.GetUninitializedObject is not a clean way of constructing
objects
* User-defined constructor does not get called
* User types can't have readonly fields
For example, ISerializable mechanism does not have Read method; it calls
user-defined constructor instead. We should provide similar mechanism.
To maintain compatibility, we may have to introduce a new interface with a
single Write method, and call user-defined ctor on read.
> .NET: Call user-defined constructor for IBinarizable objects
> ------------------------------------------------------------
>
> Key: IGNITE-3102
> URL: https://issues.apache.org/jira/browse/IGNITE-3102
> Project: Ignite
> Issue Type: Improvement
> Components: platforms
> Reporter: Pavel Tupitsyn
> Labels: .net
> Fix For: 1.7
>
>
> Currently we create user objects with
> FormatterServices.GetUninitializedObject and then call user-defined
> IBinarizable.ReadBinary method.
> This is not convenient both for us and the user:
> * FormatterServices.GetUninitializedObject is not a clean way of constructing
> objects
> * User-defined constructor does not get called
> * User types can't have readonly fields
> For example, ISerializable mechanism does not have Read method; it calls
> user-defined constructor instead. We should provide similar mechanism.
> * To maintain compatibility, we may have to introduce a new interface with a
> single Write method, and call user-defined ctor on read.
> * Another option is to introduce a [BinarizableInit] attribute. User can
> place it on a constructor, and Ignite will call it, injecting Reader and
> Ignite instances to parameters (if there are any).
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)