zzz projects Entity Framework Core EF Core
Home Articles Knowledge Base Online Examples
  • Home
  • Articles
  • Knowledge Base
  • Online Examples

Entity Framework Core - Knowledge Base (KB)

27 results in tag: database-migration

How to prevent data loss when I want to update database by using db-migration?

When I was making update my database by using db-migration, I faced a problem that was ...Automatic migration was not applied because it would result in data loss. ...(I used ...System.ComponentModel.DataAnnotations... such as ...[Required]... and ...[St...
database database-migration entity-framework entity-framework-6
asked by Said Roohullah Allem

How can I change data type of a column in SQL Server?

I am using SQL Server 2008 R2....I want to change the data type of a column (...Size...) from ...decimal... to ...int.... First, I used designer of SQL Server but SQL Server did not allow me to do it. Please attention to the picture....Then I decided to w...
database-migration entity-framework entity-framework-6 sql-server
asked by Said Roohullah Allem

DataAnnotation Atributes not applied in EF7

When i migrate a database using k ef migration add bla bla. command the data annotation attributes are not reflected to the created database...e.g. iam using the [MaxLength(2)] attribute and am getting a column with data type nvarchar(MAX) created ...Any ...
database-migration entity-framework-core
asked by user380797

Running DNX (EF7) database migration on Azure

I've been running a MVC project with ASP.NET 4.6 and EF7 locally and everything works fine. I ran the dnx . ef migration Initial commands to create the database tables, and everything ran fine. The app works. ...With Azure I have one problem, I can't seem...
asp.net azure database-migration dnx entity-framework-core
asked by Joao Sousa

How to rollback EF 7 migrations programmatically?

I would like to write a unit test which migrates to the latest schema then tears back down to nothing....For the migration I can do :...db.Database.Migrate(); ...but how to I rollback?
c# database-migration entity-framework entity-framework-core unit-testing
asked by sprocket12

Database applies ALL previous migrations on update and NOT just the new one

I'm developing a website which, as of current, both has a production and a test database. The production database is hosted externally while the test database is hosted locally....Whenever I make changes to my database I apply the changes through a migrat...
database database-migration ef-migrations entity-framework entity-framework-6
asked by J. Doe

Exclude DbContext from migrations to avoid Context-Parameter

I'm using ASP.NET EF Core with MySQL (Pomelo.EntityFrameworkCore.MySql driver). Cause such a context need some lines of specific configuration which the default DbContext with MSSQL doesn't have, I created a MySqlContext:...public class MySqlContext : DbC...
asp.net-core asp.net-core-mvc database-migration ef-code-first entity-framework-core
asked by Lion

Migrations in separate assembly how to avoid hardcoded connection string?

I'm writing ASP.NET Core and Entity Framework Core application and I want to store my data access layer in separate assembly, so I followed this tutorial: ...http://www.michael-whelan.net/ef-core-101-migrations-in-separate-assembly/...But I would also lik...
.net-core asp.net-core database-migration ef-migrations entity-framework-core
asked by micnyk

Migrating at runtime with Entity Framework Core

I'm porting a PHP/Illuminate application to ASP.NET Core/EF Core. Part of it consists of a Wordpress-like install process that asks for database credentials and then creates the necessary tables for the app to function. Essentially, I want to run some sor...
c# database-migration entity-framework entity-framework-core
asked by James

EF Core Add Migration Debugging

How can I step into ...OnModelCreating... with a breakpoint and see if my logic is wrong or if the ...ModelBuilder... is doing something I'm not expecting? I've seen lots of posts on how to debug the actual migration, but nothing on how to watch how the ...
c# database-migration ef-code-first entity-framework entity-framework-core
asked by Jeremy Holovacs

EF migration with new table collation error

I'm using Entity Framework code first, It has been working ok updating the database with db migrations up until recently......I've added a anew property to the AspNetUser table...public partial class AspNetUser { .... public ICollection<Feed> Feeds { get...
azure-sql-database database-migration ef-migrations entity-framework entity-framework-6
asked by raklos

Entity Framework Core 2.0 Add-Migration doesn't create any migration files

Recently migrated from EF Core 1.0 to EF Core 2.0, and it runs fine. Today I added a new table (code-first) and added it to my DbContext with:...public virtual DbSet<Foo> Foos { get; set; } ...When I run a migration, with my DbContext in a separate proje...
c# database-migration ef-migrations entity-framework entity-framework-core
asked by paultechguy

How to recover from Entity Framework nightmare - database already has tables with the same name

How do you get EF back in Sync with code without losing data when Update-database returns the following message...Error Message: System.Data.SqlClient.SqlException (0x80131904): There is already an object named '' in the database.
database-migration ef-migrations entity-framework entity-framework-6
asked by System.Exception

Database migration with two context in Asp.Net Core (SQL Server on Docker)

I have two Context in my Application. One in ...WebApi Project -> ApiContext (inherited from IdentityDbContext)... and another one in ...Infrastructure -> Context.......I use Official images for Microsoft SQL Server on Linux for Docker Engine (...microsof...
asp.net-core database-migration docker entity-framework entity-framework-core
asked by Cieja

Execute custom SQL script as part of Entity Framework migration

I have been using the standard add-migration approach to updating my aspnet core database on Entity Framework. I now have to move two "image" columns into a new table (and their image data), remove the columns from the original table, and set up a foreig...
database-migration ef-migrations entity-framework-core sql
asked by paultechguy

System.Data.SqlClient is not supported on this platform

I'm using ASP.NET Core 2 with Entity Framework Core 2.0.2. I created a context and ...Add-Migrations... command in Package Manager Controller works fine....However when ...Update-Database... command is used, I get an error:...System.Data.SqlClient is not ...
asp.net-core c# database-migration entity-framework-core sql-server
asked by Sasitha Iresh

Entity Framework Core on Azure: Update-Database parameter –ConnectionString does not work

I want to update database on Azure SQL to fit .Net Core application using Entity Framework Core migrations. The following command is advised online:...Update-Database -ConnectionString $ConnectionString -ConnectionProviderName "System.Data.SqlClient" ...H...
azure azure-sql-database database-migration entity-framework entity-framework-core
asked by user2341923

Changing structure of database and moving data in Entity Framework

My Database has entities ...Driver... and ...DriverWork... like this:...Edited:...public class Driver { [Key] public int Id { get; set; } public string Name { get; set; } public string Description { get; set; } } public class DriverWork...
c# database database-migration entity-framework entity-framework-6
asked by 0xaryan

Exception when trying to migrate database in Entity Framework v6.2.0 in Visual Studio v15.8.4

I have setup a database using Entity Framework, code first, every time I try to add a migration or update the database I get the following ...error message...:...PM> update-database Exception calling "CreateInstance" with "7" argument(s): "Constructor on ...
c# database-migration ef-migrations entity-framework entity-framework-6
asked by Alfie

Run seed database

How do I run the seed method in .NET Core?...This is my onModelBuilding method:...protected override void OnModelCreating(ModelBuilder modelBuilder) { Users user = new Users { Id = Guid.NewGuid().ToString(), UserName = "system@admi...
c# database-migration entity-framework-core
asked by JianYA

Page 1 of 2
  • 1
  • 2
  • »

Prime Library

Performance

  • Entity Framework Extensions
  • Entity Framework Classic
  • Bulk Operations
  • Dapper Plus

Expression Evaluator

  • C# Eval Expression
  • SQL Eval Function
More Projects...

Related

  • EF Extensions Online Benchmark
  • WIN an EF Extensions license
  • EF6 BatchSaveChanges for only $79
Get monthly updates by subscribing to our newsletter!
SUBSCRIBE!