0

For example, I use Entity Framework to create a database. I create a class and it has a List field. How will it look like in table? If it is int field, it is gonna be a column with numbers (same with strings, booleans...), I get it. But what about lists?

Sofia Bo
  • 679
  • 1
  • 10
  • 20

1 Answers1

2

Based on what I can tell from your question you're wondering what happens if you're creating a database with Entity Framework from an code-first approach, from an entity which contains a list as a property. Entity Framework doesn't save lists as columns in your table, instead it creates a relationship between the two types of entities. If you have a class "Bob" which contains a List of type , then a relationship will be established. If the data type is primitive, you could either create a new entity that stores the primitive datatype or do some sort of string processing as explained by the answer in this question: EF can't store list string

EDIT: Read more about relationship databases here on Entity Framework tutorial: Configure one to many EF