Answer the question
In order to leave comments, you need to log in
Help with Dapper and SQLite C#. How to get data and write?
Hello. Help. I have the code below, for some reason it writes values from the database only to the LastName properties. For some reason, FirstName has null. What's the matter?
public static List<PersonModel> LoadPeople()
{
using (IDbConnection cnn = new SQLiteConnection(GetConnectionString()))
{
var output = cnn.Query<PersonModel>(@"select * from Person", new DynamicParameters());
return output.ToList();
}
}
public class PersonModel
{
public int Id { get; set; }
public string FirtstName { get; set; }
public string LastName { get; set; }
public string FullName
{
get { return FirtstName + " " + LastName; }
}
}
public static string GetConnectionString(string id = "Default")
{
return ConfigurationManager.ConnectionStrings[id].ConnectionString;
}
<connectionStrings>
<add name="Default" connectionString="Data Source=.\DemoDB.db;Version=3;" providerName="System.Data.SqlClient" />
</connectionStrings>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question