ef-migrations

Unable to update database to match the current model

天涯浪子 提交于 2020-01-25 20:38:07
问题 I created a fresh Azure Mobile Services project and published to a newly created service on Azure. I then published the project to Azure and verified that I could post/get from it. Next, I enabled migration via the nuget manager console by following a guide i found online online and that I found on MSDN to set up data migration. I walked through the steps, adding my initial migration and re-publishing it to Azure. I did not make any changes to my models. The only thing I did after the first

Incorrect value when saving enum

流过昼夜 提交于 2020-01-24 05:05:26
问题 I'm having a little difficulty getting Entity Framework 5 Enums to map to an integer column in a migration. Here's what the code looks like: [Table("UserProfile")] public class UserProfile { public enum StudentStatusType { Student = 1, Graduate = 2 } [Key] public int UserId { get; set; } public string UserName { get; set; } public string FullName { get; set; } public StudentStatusType Status { get; set; } } The migration looks like this: public partial class EnumTest : DbMigration { public

Migrations is enabled for context ''but the database does not exist or contains no mapped tables

倖福魔咒の 提交于 2020-01-23 09:50:12
问题 CreditoImobiliarioBB.Web All interface are defined here. Has reference to the project CreditoImobiliarioBB.EntityFramework and EF6. No configuration (we use FluentApi) or migrations is defined here. CreditoImobiliarioBB.EntityFramework Here is defined our generic repository and DbContext. All configurations and migrations are implemented here . CreditoImobiliarioBB.Domain Our design domain. Here are all our domain classes and interfaces (eg IEntity ) CreditoImobiliarioBB.Repository Here is

More than one migrations configuration type was found in the assembly ''. Specify the name of the one to use. On add-migration

好久不见. 提交于 2020-01-23 05:34:24
问题 In Package Manager Console, I'm trying to update my database. When I enter this command : add-migration Migration1 And I get this : More than one migrations configuration type was found in the assembly 'MyProject.POCO'. Specify the name of the one to use. I googled the error and I get this : add-migration InitialBSchema -IgnoreChanges -ConfigurationTypeName ConfigurationB -ProjectName ProjectContextIsInIfNotMainOne -StartupProjectName NameOfMainProject -ConnectionStringName ContextB But I don

SQL Server CE Code First migrations problems

馋奶兔 提交于 2020-01-22 19:44:37
问题 I have a bunch of problems trying to enable (code-first) migrations for my SQL Server Compact 4.0 database for my desktop .NET app. Enable-Migrations does work and the directory Migrations is created. After that when I try to run Add-Migration InitialMigration , I get: Access to the database file is not allowed. [ 1914,File name = Logo.sdf,SeCreateFile ] This is the first problem, but I solved it by running Visual Studio as Administrator... don't like that solution and also don't know if

SQL Server CE Code First migrations problems

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-22 19:42:12
问题 I have a bunch of problems trying to enable (code-first) migrations for my SQL Server Compact 4.0 database for my desktop .NET app. Enable-Migrations does work and the directory Migrations is created. After that when I try to run Add-Migration InitialMigration , I get: Access to the database file is not allowed. [ 1914,File name = Logo.sdf,SeCreateFile ] This is the first problem, but I solved it by running Visual Studio as Administrator... don't like that solution and also don't know if

Entity framework , many changes missing after applying all migrations successfully,

给你一囗甜甜゛ 提交于 2020-01-17 06:38:08
问题 get-migrations shows full list of all my migrations but only half of them is in the _MigrationHistory and the database has changes from these half of them. No errors , all migrations applied successfully. issue comes while applying migrations having int to float changes were i had to manually add Sql("ALTER TABLE xxx DROP CONSTRAINT DF__TBL_OPRTN__OPRTN__6497E884"); . Is there any possible reason for these kind of behaviour from ef , any way to debug this? thanks 来源: https://stackoverflow.com

Entity Framework Migration: Why does it ignore snapshot and take __MigrationHistory into account?

风流意气都作罢 提交于 2020-01-16 07:07:10
问题 I'm using EF 6.0.0 and .Net 4.5. I face a very confusing problem. Me and one of my colleagues are working on the domain model section of our project on two different clients. The problem is: 1- Me and my colleagues start with the absolutely identical project and we are completely synced with the source control. 2- When I change the model for example add a property then Add-Migration FromA then Update-Database it works great. The generated code file contains just one command that is to add the

.Net Core - Entity Framework Core Migrations - Production

心已入冬 提交于 2020-01-15 05:39:11
问题 After reading many questions here, on Asp.Net's Github (this one comes to mind, ServerFault and SoftwareEngineering, I have decided to ask a question of my own. The Problem Code-First Migrations make live incredibly easy during early development. Staging- or Production-Environments are harder to update, especially during the initial roll-outs which may require frequent updates. Updating the production DB is a lot harder, and automatic migrations are out of the question for a number of very

How Do I Migrate Tenant Databases and Host Database in Asp.NET ZERO / Boilerplate?

本秂侑毒 提交于 2020-01-15 03:51:10
问题 I am using the ASP.NET ZERO framework with ASP.NET Core and Angular for my current project. I am also using the 'MultiTenancy - MultiDatabase' feature of ASP.Net ZERO. In application I have added a 'Tenant1-Database' connection string in create new Tenant. Now i have two databases: Host-Database Tenant1-Database When I create a new Tenant, 'Tenant1-Database' is automatically update as per previous migration files. But when I update the model with a new property and try to migrate the database