15
I have several projects and each project has a context.
I would like to know, how to use the Migrations to update and generate only one database of these various contexts?
15
I have several projects and each project has a context.
I would like to know, how to use the Migrations to update and generate only one database of these various contexts?
1
Multiple contexts are useful for structuring/isolating project areas; obviously this increases complexity. Then you can create each context by pointing to the same basis and perform the work normally.
-1
One differential of EF6 is that it was released with the functionality to support multiple contexts. I found some answers to your problem :
Tutorial :
Answer :
-2
You create only ONE connection, and use it for your project. So:
Context contexto = new Context(); <----(cria uma conexao)
ProjetoRepository nomeRepositorio = new ProjetoRepository (contexto);
(ProjetoRepository usando a conexao "contexto ")
OutroProjetoRepository nomeOutroReposito = new OutroProjetoRepository (contexto);
(OutroProjetoRepository usando a mesma conexao "contexto ")
-4
Since each context is a completely different instance I believe that this is not possible. Unless you create a context that manages all contexts and encompasses in one.
If you don’t think it’s possible, demonstrate why. If you think it’s creating a context that manages others, demonstrate what to do.
Browser other questions tagged c# asp.net entity-framework-6 migrations
You are not signed in. Login or sign up in order to post.
have you read this article: https://msdn.microsoft.com/en-us/data/jj591621.aspx. ? In this article he mentions a new EF6 configuration that allows this,
ContextKey
,– Tobias Mesquita
Yes, but it does not specify about the various projects and contexts.
– Ronaldo Asevedo
And the entities of the Projects communicate with each other
– Ronaldo Asevedo
See if this thred helps you, http://stackoverflow.com/a/10009491/2187618.
– davidterra
a while ago already... managed to solve? I understood that each project has a context, but the structure of the bank is the same used by all of them?
– Bruno Piovan
As far as I know to generate a single bank all contexts must point to the same path to be able to unify all entities
– Leo