Open erossini opened 7 years ago
I've created a new Xamarin
project and I added the latest version of sqlite-net-pcl
1.3.3. I noticed in my project now there is .NET Core
. I defined an entity
public interface ITableEntityMyExpenses {
int Id { get; set; }
bool IsDeleted { get; set; }
DateTime UpdatedDate { get; set; }
}
Then a BaseTable
public class BaseTableMyExpenses : ITableEntityMyExpenses {
[PrimaryKey, AutoIncrement]
[Indexed]
public int Id { get; set; } = 0;
}
And then a table
public class Expense : BaseTableMyExpenses {
public DateTime ExpenseDate { get; set; }
public int Cost { get; set; }
}
At the first time the app creates correctly the database. The database is empty.
If I try to add a new record in the database I receive this error:
An item with the same key has already been added. Key: 3
(TKey key, TValue value, Boolean add) at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable
1 source, Func
2 keySelector, Func2 elementSelector, IEqualityComparer
1 comparer) at SQLite.EnumCacheInfo..ctor(Type type) at SQLite.EnumCache.GetInfo(Type type) at SQLite.SQLiteCommand.BindParameter(sqlite3_stmt stmt, Int32 index, Object value, Boolean storeDateTimeAsTicks) at SQLite.PreparedSqlLiteInsertCommand.ExecuteNonQuery(Object[] source)
at SQLite.SQLiteConnection.Insert(Object obj, String extra, Type objType) at SQLite.SQLiteConnection.Insert(Object obj) at MyExpenses.Repository.MyExpensesDatabase.SaveItem[T](T item) at MyExpenses.Repository.MyExpensesRepository.SaveExpense(Expense item)
at MyExpenses.ViewModels.ExpenseItemViewModel.SaveExpenseOnDB() at MyExpenses.ViewModels.ExpenseItemViewModel.d__42.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at MyExpenses.ViewModels.ExpenseItemViewModel.<b__41_0>d.MoveNext()
What is wrong?
I created an update of this error here on StackOverflow.
Hi guys, I updated MobileCenter. MobileCenter added .NET Core in my projects. The bad consequence is SQLite is working but not for select. When I execute this easy code
I receive an error
with this StackTrack
I have all my applications that working with the same procedure and it is working well. Tagged: sqlite.net core