Description:
This is an easy development, but it is a big feature! But should be easy to be incorporated within the library.
In the IL and compiled-expressions, consider a type handlers/resolvers during the transformation process. With this, we allow the control to the consumer of the library on how are they going to handle specific values of the columns 2-ways (getter, setter).
Usability:
public interface IResolver<T1, TResult>
{
TResult Resolve(T1 input);
}
public class PersonAddressGetResolver : IResolver<string, Address>
{
public Address Resolve(string input)
{
return JSON.Deserialize<Address>(input);
}
}
public class PersonAddressSetResolver : IResolver<Address, string>
{
public string Resolve(Address input)
{
return JSON.Serialize(input);
}
}
public class PropertyHandlerAttribute : Attribute
{
public ResolveAttribute(IResolver<T1, TResult> getResolver,
IResolver<T1, TResult> setResolver)
{}
public IResolver<T1, TResult> GetResolver { get; }
public IResolver<T1, TResult> SetResolver { get; }
}
public class Address
{
public int Id { get; set; }
public string State { get; set; }
public int ZipCode { get; set; }
public string Country { get; set; }
}
public class Person
{
public int Id { get; set; }
public string Name { get; set; }
[Map("AddressAsJson"), PropertyHandler(typeof(PersonAddressGetResolver), typeof(PersonAddressSetResolver))]
public Address Address { get; set; }
}
The GetResolver and SetResolver must be compiled AOT so the performance of the ILs and compiled-Expressions must not be affected.
Use Cases/Business Cases
This handlers can solve a lot of Use Cases or Business Scenarios. See some below.
- Handle the property value
- Handle the entity relationships
- Handle the conversion (JSON to Class, Column Value to ENUM, or whatever...)
- Can handle even the auditing/tracing
- And many more
Acceptance Criteria
- Performance should not be affected.
- Unit Tests must be provisioned for (PropertyValue, EntityRelationships, Conversion).
- Integration Tests must be provisioned for (PropertyValue, EntityRelationships, Conversion).
Impact
It will impact the Core implementation (all extended library). Ensure that all Unit Tests and Integration Tests are all running.
Related
There is a relevant information that we can get from #366 issue.
Description:
This is an easy development, but it is a big feature! But should be easy to be incorporated within the library.
In the IL and compiled-expressions, consider a type handlers/resolvers during the transformation process. With this, we allow the control to the consumer of the library on how are they going to handle specific values of the columns 2-ways (getter, setter).
Usability:
Use Cases/Business Cases
This handlers can solve a lot of Use Cases or Business Scenarios. See some below.
Acceptance Criteria
Impact
It will impact the Core implementation (all extended library). Ensure that all Unit Tests and Integration Tests are all running.
Related
There is a relevant information that we can get from #366 issue.