You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I work with Domain Driven Design concept and i am having on problem to integrate two DbContexts. Apparently is a bug, but i want friends' opinion.
I have two domains. In each one of domains exists one class with the same name "city". This class refers to same table in the database, but in one context is important only some properties and in other context, others properties. This is motive of have two class "City" in two context pointing out to same table, all configurated through of Mapping of contexts (https://docs.microsoft.com/en-us/ef/core/modeling/relational/tables)
I am working with native Dependency Injection of Asp Net Core. Create one project "MyProject.Infra.CrossCutting.IoC" of CrossCutting only to configure and inject the dependency. In this project contains only one static class with one static function to receive with parameter an IServiceCollection to configure my dependency injection.
In Asp Net Core project, have ConfigureServices function. Is In this function that I call my static class and pass how parameter the IServiceCollection.
NOW IS THE PROBLEM!! When i running entity framework core migration of the Domain 1 is create table City, but when i running migration of the Domain 2, I receive the message of output console saying that the City Table already exists. Migration can not understand the changes writes in MigrationHistory of the Domain 1.
Basically, what i want is integrate two or more context insomuch that migration understand through of Mapping of Contexts that the classes City of Context 1 and Context 2 mold my City Table
Further technical details
EF Core version: 1.1.0
Database Provider: Microsoft.EntityFrameworkCore.SqlServer 1.1.0
Operating system: Windows 10 Version 10.0.14393
IDE: Visual Studio 2017 RC Version 4.6.01586
The text was updated successfully, but these errors were encountered:
This is essentially a duplicate of #2725. Migrations doesn't reason about other models, what's already in the database, etc. It is purely about creating/altering the schema for a given model.
The easiest way to handle this now, is to just delete the CreateTable call for the City table when you scaffold the migration for Domain 2.
I work with Domain Driven Design concept and i am having on problem to integrate two DbContexts. Apparently is a bug, but i want friends' opinion.
I have two domains. In each one of domains exists one class with the same name "city". This class refers to same table in the database, but in one context is important only some properties and in other context, others properties. This is motive of have two class "City" in two context pointing out to same table, all configurated through of Mapping of contexts (https://docs.microsoft.com/en-us/ef/core/modeling/relational/tables)
I am working with native Dependency Injection of Asp Net Core. Create one project "MyProject.Infra.CrossCutting.IoC" of CrossCutting only to configure and inject the dependency. In this project contains only one static class with one static function to receive with parameter an IServiceCollection to configure my dependency injection.
In Asp Net Core project, have ConfigureServices function. Is In this function that I call my static class and pass how parameter the IServiceCollection.
NOW IS THE PROBLEM!! When i running entity framework core migration of the Domain 1 is create table City, but when i running migration of the Domain 2, I receive the message of output console saying that the City Table already exists. Migration can not understand the changes writes in MigrationHistory of the Domain 1.
Basically, what i want is integrate two or more context insomuch that migration understand through of Mapping of Contexts that the classes City of Context 1 and Context 2 mold my City Table
Further technical details
EF Core version: 1.1.0
Database Provider: Microsoft.EntityFrameworkCore.SqlServer 1.1.0
Operating system: Windows 10 Version 10.0.14393
IDE: Visual Studio 2017 RC Version 4.6.01586
The text was updated successfully, but these errors were encountered: