Skip to content

[Mapping] API for easy assigning single fields #2

@DevJohnC

Description

@DevJohnC

An API for assigning a single field's value via IDataModelWriter would make code that needs to perform simple mapping tasks without a full, constructed, compiled mapping method, much easier to author and maintain.

Current:

var fieldGraphPath = TypeModel.GetModelOf<TView>()
    .GetField(obj => obj.PropertyToAssign);
var modelReadWriter = new ObjectDataModelWriter<TView>(viewInstance);
modelReadWriter.WriteField<Guid>(fieldGraphPath.Field, Guid.NewGuid());

The current has a problem of not navigating to the correct position in the object graph, with error handling, and returning back to the current position in the graph. It's also possibly overly verbose.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions