Skip to content Skip to sidebar Skip to footer

How To Store List In Sql Server From Asp.net Core?

I have this table in my database and I want to store incoming data: public string Id { get; set; } = default!; public double? Name { get; set; } = default!; public string? FamilyNa

Solution 1:

I assume you meant to ask how you store a list in a relational database? Because if if it is a file store or NoSql database then it's fairly easy.

However the short answer is, you don't. It's not what a relational database was meant to do. See this Post.

That being said, there are ways around it.

  1. Store the list as a string:

    var listString = JsonConvert.Serialize(MyList);
    

    Then you can store that string in the database easily

  2. Save the list as a file on the server, then just store the location of the file in the database.

Post a Comment for "How To Store List In Sql Server From Asp.net Core?"