ef-code-first Questions
4
I'm trying to implement a caching scheme for my EF Repository similar to the one blogged here. As the author and commenters have reported the limitation is that the key generation method cannot pro...
Ousley asked 26/11, 2011 at 2:37
1
While looking for a solution to store all our enums as strings in the database, i came up with the following code.
protected override void ConfigureConventions(ModelConfigurationBuilder builder)
{
...
Solange asked 11/11, 2021 at 9:44
5
Solved
I'm developing a plugin application with EF6, code first.
I have one main context with an entity called User:
public class MainDataContext : DbContext
{
public MainDataContext(): base("MainDataC...
Negligible asked 15/1, 2015 at 17:53
9
Solved
I have a project built in visual studio 2013 environment with the Db built using EF 5 code first.
I have had my APIs working fine for a long time but all of a sudden I started to get this error th...
Jonme asked 15/8, 2016 at 14:19
6
Solved
I want my domain class name to match my db table name (no pluralisation).
In EF Core 1.1, I used this code to do that:
public static void RemovePluralisingTableNameConvention(this ModelBuilder mo...
Plumber asked 29/9, 2017 at 22:32
2
Solved
I'm working in a project that uses EF Code First. I'm trying to use migration features. I don't want to use Package Console Manager. How can I execute the "Add-Migration" and "Update-Database" prog...
Manella asked 2/2, 2016 at 3:58
12
I am getting an
SQLite Error 14: 'unable to open database file'
with EF Core code first, no idea why. I worked fine the first time, the database file got created in c:\users\username\AppData\Loca...
Sueannsuede asked 28/5, 2017 at 21:56
4
Solved
I am new to EF5 Code First and I'm tinkering with a proof-of-concept before embarking on a project at work.
I have initially created a model that looked something like
public class Person {
publ...
Grader asked 12/2, 2013 at 16:28
6
Solved
I'm just looking into using EF migrations for our project, and in particular for performing schema changes in production between releases.
I have seen mentioned that there is an API to perform th...
Desist asked 1/6, 2012 at 10:37
2
Solved
I've been using Entity framework code first in a project and all the tables have been created /modified a while ago. Now I need to add an unique constraint to a table. I want to create a migration ...
Vltava asked 17/3, 2014 at 5:5
4
Solved
I only watched a few webcasts before I went head first in to designing a few Entity Framework applications. I really didn't read that much documentation and I feel like I am suffering for it now.
I...
Reynoso asked 5/10, 2011 at 1:33
2
Solved
I am trying to use code-first within my existing project. I want to exclude existing entities from migrations I generate for new entities.
I have all models in separate class library project e.g. ...
Inscription asked 30/7, 2014 at 6:25
20
Solved
I've been wrestling with this for a while and can't quite figure out what's happening. I have a Card entity which contains Sides (usually 2) - and both Cards and Sides have a Stage. I'm using EF Co...
Charmine asked 15/6, 2013 at 19:52
4
I want create a table with a primary key shadowed (out of the model).
public class Person
{
public string Name { get; set; }
}
public class PersonEntityTypeConfiguration : IEntityTypeConfigurati...
Kynewulf asked 24/7, 2018 at 17:3
14
Solved
I am using Visual Studio 2015 and dotnet core and trying to develop an EF Core Code First project using Sqlite and this documentation / tutorial, which also uses Sqlite => NET Core - New Database
...
Lard asked 24/3, 2017 at 5:0
1
Does anybody know how to generate entity framework code first migrations without having to use the package manager console?
I'm having a significant problem whereby on occasion running add-migrati...
Hepato asked 8/6, 2015 at 13:14
4
Solved
Originally I used EF 6 code first to create a new database and two new tables. The code is:
public class TestingContext : DbContext, IDisposable
{
public DbSet<CallDataRecord> CallDataReco...
Yaya asked 14/5, 2014 at 18:49
3
Solved
It's a very small code-first EF6 Project. I added a migration and updated a database successfully. Here's the output:
PM> update-database -Verbose
Using StartUp project 'ChattyServer'.
Usi...
Bullroarer asked 5/5, 2016 at 19:46
15
Solved
I'm trying to insert records in two tables, but getting the exception. Could you please help me to resolve the issue.
First I tried the below code.
await _testRepository.InsertAsync(test);
await ...
Silvia asked 11/4, 2018 at 17:51
9
I want to set the default collation for a database, when Entity Framework Code First creates it.
I've tried the following:
public class TestInitializer<T> : DropCreateDatabaseAlways<T>...
Chantalchantalle asked 21/8, 2012 at 12:33
2
Solved
I have an ASP.NET Core project which uses code-first in EF Core.
After upgrading from .NET 7 to .NET 8 and also EF Core packages I'm faced with an error
SqlException: Incorrect syntax near '...
Cranial asked 19/11, 2023 at 4:40
11
Solved
How can I store an array of doubles to database using Entity Framework Code-First with no impact on the existing code and architecture design?
I've looked at Data Annotation and Fluent API, I've a...
Maltese asked 5/3, 2013 at 10:3
1
I have two DbContext in my project, i am trying to run EF Add-Migration pointing to a specific DbContext, but i have being encountering the below error.
Add-Migration Initial -ContextTypeName Syst...
Ground asked 13/4, 2019 at 0:39
19
is there "elegant" way to give specific property a default value ?
Maybe by DataAnnotations, something like :
[DefaultValue("true")]
public bool Active { get; set; }
Thank you.
Mecham asked 23/10, 2013 at 23:15
5
Solved
I have a User < Country model. A user belongs to a country, but may not belong to any (null foreign key).
How do I set this up? When I try to insert a user with a null country, it tells me that...
Nealneala asked 14/4, 2011 at 19:46
1 Next >
© 2022 - 2025 — McMap. All rights reserved.