Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Json Entity #3486

Closed
wangkanai opened this issue Oct 20, 2015 · 1 comment
Closed

Json Entity #3486

wangkanai opened this issue Oct 20, 2015 · 1 comment

Comments

@wangkanai
Copy link

It would be good if we have an entity type that we write a class like any other and store in the master entity as string in json format, while it could be serialize & deserialize;
Entity:

public class Person
{
    [Key]
    public int Id { get; set; }
    public DateTime Birthday { get; set; }
    [Json]
    public Name Name { get; set; }
}

public class Name
{
    public string Firstname { get; set; }
    public string Lastname { get; set; }
}

Json:

{
  "Firstname": "Sarin",
  "Lastname": "Na Wangkanai"
}

Right now this solution would make ef7 not be able to create a model i think it fall under complex type where you need to define a key.
The entity type 'EF7.Name' requires a key to be defined.

@rowanmiller
Copy link
Contributor

In EF6 we had a column in the parent table for each property in the complex type but we agree that serializing the values into a single column is also a neat idea. We probably want to have options to select different strategies and I added a note to #246 to consider this when we design the feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants