Skip to content

Shorthand syntax for creating entites #39

@tpluscode

Description

@tpluscode

It would be very handy to use anonymous objects to create entities, especially ones with a blank id. Currently a blank node id must be explicitely created

var entity = context.Load<IPerson>("some URI");
var blankId = entity.CreateBlankId();
var address = context.Create<IAddress>(blankId);
address.City = "New York";
entity.Address = address;

Here's how this could work instead

var entity = context.Load<IPerson>("some URI");
entity.Address = new {
   City = "New York"
};

Internally a new blank identitifier would be generated for the anonymous object and each property would be translated to the destination type. In this case the properties would have to match those of IAddress.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions