ef-migrations

Creating a Symmetric AES128 Key in SQL Server based on Key and Initial Vector

我的未来我决定 提交于 2020-03-18 16:37:49
问题 I have some Key and Initial Vector, which I'm using for encryption purposes in my .NET app. Let's say they are: Key = 0x0102030405060708090A0B0C0D0E IV = 0xA1A2A3A4A5A6A7A8A9AAABACADAE In some cases I would like to perform encryption on the SQL Server (not in the app), but decrypt the data in the app. I thought that I'll might be able to create a temporary symmetric key in the DB and perform encryption: CREATE SYMMETRIC KEY #TempKey WITH ALGORITHM = AES_128 , IDENTITY_VALUE = ??? , KEY_SOURCE

Code-first migration: How to set default value for new property?

我是研究僧i 提交于 2020-02-12 17:35:21
问题 I am using EF6 for storing instances of the report class in my database. The database already contains data. Say I wanted to add a property to report , public class report { // ... some previous properties // ... new property: public string newProperty{ get; set; } } Now if I go to the package-manager console and execute add-migration Report-added-newProperty update-database I will get a file in the '/Migrations' folder adding a newProperty column to the table. This works fine. However, on

Code-first migration: How to set default value for new property?

与世无争的帅哥 提交于 2020-02-12 17:33:33
问题 I am using EF6 for storing instances of the report class in my database. The database already contains data. Say I wanted to add a property to report , public class report { // ... some previous properties // ... new property: public string newProperty{ get; set; } } Now if I go to the package-manager console and execute add-migration Report-added-newProperty update-database I will get a file in the '/Migrations' folder adding a newProperty column to the table. This works fine. However, on

How do I set a default value for a new column using EF6 migrations?

倾然丶 夕夏残阳落幕 提交于 2020-02-06 04:42:42
问题 I know that you can manually manipulate the EF generated migration file to add in the 'defaultValue: 1' parameter to the 'AddColumn' method, but it does not seem to be generating the correct Oracle translation when I look at the generated script. See my EF migration 'Up' method below: public override void Up() { AddColumn("TABLE", "NEW_COLUMN", c => c.Decimal(nullable: false, precision: 10, scale: 0, defaultValue: 1)); } And after running 'update-database -script' I get the following

Receiving "The model backing the 'Context' context has changed… on Add-Migration after EF 5 upgrade

♀尐吖头ヾ 提交于 2020-02-03 04:49:05
问题 We are building an app using code-first migrations. We had been using Entity Framework 5.0.0 RC, and we updated our NuGet package for Entity Framework. The database has been in sync with the models context. Code first migrations have been working fine for months. When we modify our models, and try to add a migration, or even query for migrations, we receive the System.InvalidOperationException for the model backing changed. Well, obviously it has, I'm trying to add a migration. We're not sure

Entity Framework 6 Code First migrations - multiple branches for production

一笑奈何 提交于 2020-02-01 15:32:33
问题 In my project we have a branch model that has a separate development branch and has a separate branch for each release. It may look like this: dev ______ ______ / \ / \ master --+---+----+---+---+----+----+--- (...) r1 \______/ r2 \_______/ So we develop on dev merge it to master and then we create a release branch (r1, r2, ...). We want to use EF 6 (manual not automatic) migrations but we have a question that we don't know how to answer. Imagine this: dev _(1)__ ____(4) / \ / \ master --+---

Entity Framework 6 Code First migrations - multiple branches for production

蹲街弑〆低调 提交于 2020-02-01 15:31:06
问题 In my project we have a branch model that has a separate development branch and has a separate branch for each release. It may look like this: dev ______ ______ / \ / \ master --+---+----+---+---+----+----+--- (...) r1 \______/ r2 \_______/ So we develop on dev merge it to master and then we create a release branch (r1, r2, ...). We want to use EF 6 (manual not automatic) migrations but we have a question that we don't know how to answer. Imagine this: dev _(1)__ ____(4) / \ / \ master --+---

Manually Provide DbContext to DbMigrator

十年热恋 提交于 2020-01-31 15:07:12
问题 Platform .NET 4.5 and Entity Framework 6. Question I have the following code to execute a Migration: //The following function just returns an object of the Configuration() class //generated by code migrations var migratorConfig = currentMigrationProvider.CreateDbMigrationConfiguration(); var dbMigrator = new System.Data.Entity.Migrations.DbMigrator(migratorConfig); dbMigrator.Update(); The problem is that Update() function tries to create an instance of my DbContext class and for a few good

Manually Provide DbContext to DbMigrator

会有一股神秘感。 提交于 2020-01-31 15:06:53
问题 Platform .NET 4.5 and Entity Framework 6. Question I have the following code to execute a Migration: //The following function just returns an object of the Configuration() class //generated by code migrations var migratorConfig = currentMigrationProvider.CreateDbMigrationConfiguration(); var dbMigrator = new System.Data.Entity.Migrations.DbMigrator(migratorConfig); dbMigrator.Update(); The problem is that Update() function tries to create an instance of my DbContext class and for a few good

Manually Provide DbContext to DbMigrator

邮差的信 提交于 2020-01-31 15:04:27
问题 Platform .NET 4.5 and Entity Framework 6. Question I have the following code to execute a Migration: //The following function just returns an object of the Configuration() class //generated by code migrations var migratorConfig = currentMigrationProvider.CreateDbMigrationConfiguration(); var dbMigrator = new System.Data.Entity.Migrations.DbMigrator(migratorConfig); dbMigrator.Update(); The problem is that Update() function tries to create an instance of my DbContext class and for a few good