Quantcast
Channel: Entity Framework
Viewing all 10318 articles
Browse latest View live

Commented Unassigned: Loading an entity with Query doesn't work [2734]

$
0
0
I have a User entity with a collection of Roles that I am trying to load.

I execute this statement...

_Context.Entry(user).Collection(x => x.Roles) .Load();

The User's Roles are loaded. I can trace the database and see that 11 rows are returned and 11 Roles are in the collection.

I am trying to load the Roles based on other criteria but in my debugging I have found that the following statement...

_Context.Entry(user).Collection(x => x.Roles) .Query().Load();

Will return the same exact results as in the previous example but the Roles collection doesn't have 11 items, it has 0.

Even if I do a super simple where clause such as...

_Context.Entry(user).Collection(x => x.Roles) .Query().Where(x => x.RoleId > 0).Load();

11 rows are returned from the database but zero items are added to the collection.


Comments: You nailed it! It is indeed a many to many relationship. I am trying to load only a subset of the roles for a user. I have a list of roles that I want to load for a user, not all of them. Something like this... ``` _Context.Entry(user).Collection(x => x.Roles) .Query() .Where(x => myCollection.Contains(x.RoleId)) .Load(); ``` The SQL generated is spot on but as you explained, the results are not loaded. Do you have any suggestions on how to load my Roles collection? Thanks

Created Unassigned: error 0152: No Entity Framework provider found for the ADO.NET provider with invariant name"Advantage.Data.Provider" Make sure the provider is registered...... [2739]

$
0
0
I am writing a custom EF6 provider.I am able to connect to a database and also see the tables after making changes in app.config.

While using the functionality of Generate Database from model, I am getting Null reference exception in GetAlldAssociationSets() On debugging my SASDLtoADS.tt file, I found that I get the above error (error 0152 ..) in CreateStoreItemCollection().
If EF was not registered properly , in app.config file , then shouldn't I also get an error while connecting to the database?
I have registered my Data Provider in GAC and also my EF provider in GAC.
What all steps could I try to resolve this error?

Attaching App.config file.

Created Unassigned: No Lazy Loading in EF 6.1.3? [2740]

$
0
0
It looks like lazy loading doesn't work in EF 6.1.3.

I have created the smallest possible project to evaluate lazy loading. It can be [downloaded here](https://dl.dropboxusercontent.com/u/77113703/LazyLoadingTest.zip).

It shows that lazy loading is not working - although I have defined a navigation property as being virtual.

I'm baffled.

To see that the Country property is never loaded you need to debug the only available unit test in the project:

```
namespace LazyLoadingTest
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
using (MyContext ctx = new MyContext())
{
Person p = new Person("Axel", 1);

ctx.Persons.Add(p);
ctx.SaveChanges();

p = ctx.Persons.Find(1);

Assert.IsNotNull(p.Country);
}
}
}
}
```


This is the corresponding entity:

```
namespace LazyLoadingTest.EF.Entities
{
public class Person
{
public int Id { get; set; }
public string Name { get; set; }

public int CountryId { get; set; }
public virtual Country Country { get; set; }



public Person()
{ }

public Person(string name, int countryId)
{
Name = name;
CountryId = countryId;
}
}
}
```

Commented Unassigned: error 0152: No Entity Framework provider found for the ADO.NET provider with invariant name"Advantage.Data.Provider" Make sure the provider is registered...... [2739]

$
0
0
I am writing a custom EF6 provider.I am able to connect to a database and also see the tables after making changes in app.config.

While using the functionality of Generate Database from model, I am getting Null reference exception in GetAlldAssociationSets() On debugging my SASDLtoADS.tt file, I found that I get the above error (error 0152 ..) in CreateStoreItemCollection().
If EF was not registered properly , in app.config file , then shouldn't I also get an error while connecting to the database?
I have registered my Data Provider in GAC and also my EF provider in GAC.
What all steps could I try to resolve this error?

Attaching App.config file.

Comments: Have you tested with the 6.1.3 runtime AND Tools?

New Post: Mapping of scalar UDF with enum as return type

$
0
0
Hi,

I have custom store convention which is used to translate method calls found in LINQ queries to scalar UDF functions. All functions are decorated with DbFunction attribute. Everything works as expected. You can see the code here.

But I want to modify some methods to return enum instead of int. I think it should work, but I always get the following exception.
The specified method 'Some.Documents.AccessType GetAccessType(Int64, Int64)' on the type 'Some.Documents.Docs' cannot be translated into a LINQ to Entities store expression because its return type does not match the return type of the function specified by its DbFunction attribute.
The modified method looks like this.
[DbFunction("UDF", "GetAccessType")]         
public static AccessType GetAccessType(long documentId, long userId)
{
    throw new NotImplementedException();
}
What do I need to make it working?

Thank you!

Commented Unassigned: error 0152: No Entity Framework provider found for the ADO.NET provider with invariant name"Advantage.Data.Provider" Make sure the provider is registered...... [2739]

$
0
0
I am writing a custom EF6 provider.I am able to connect to a database and also see the tables after making changes in app.config.

While using the functionality of Generate Database from model, I am getting Null reference exception in GetAlldAssociationSets() On debugging my SASDLtoADS.tt file, I found that I get the above error (error 0152 ..) in CreateStoreItemCollection().
If EF was not registered properly , in app.config file , then shouldn't I also get an error while connecting to the database?
I have registered my Data Provider in GAC and also my EF provider in GAC.
What all steps could I try to resolve this error?

Attaching App.config file.

Comments: Yes I have tested with 6.1.3. I am still facing the same issue.

Commented Unassigned: error 0152: No Entity Framework provider found for the ADO.NET provider with invariant name"Advantage.Data.Provider" Make sure the provider is registered...... [2739]

$
0
0
I am writing a custom EF6 provider.I am able to connect to a database and also see the tables after making changes in app.config.

While using the functionality of Generate Database from model, I am getting Null reference exception in GetAlldAssociationSets() On debugging my SASDLtoADS.tt file, I found that I get the above error (error 0152 ..) in CreateStoreItemCollection().
If EF was not registered properly , in app.config file , then shouldn't I also get an error while connecting to the database?
I have registered my Data Provider in GAC and also my EF provider in GAC.
What all steps could I try to resolve this error?

Attaching App.config file.

Comments: I found that I am getting this error in "CsdlToSsdlAndMslActivity" "The SSDL generated by the activity called 'CsdlToSsdlAndMslActivity' is not valid and has the following errors: \r\nNo Entity Framework provider found for the ADO.NET provider with invariant name 'Advantage.Data.Provider'. Make sure the provider is registered in the 'entityFramework' section of the application config file. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information."} System.SystemException {System.InvalidOperationException}

New Post: Async execution DbConcurrencyException handling

$
0
0
Consider the infamous exception:
A second operation started on this context before a previous asynchronous operation completed. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context. Any instance members are not guaranteed to be thread safe.
Whilst, I understand the reasons behind this exception I consider the exception generated extremely unhelpful!

I have an application that during initialisation fires multiple async commands.

Occasionally I was getting DbConcurrencyExceptions but it was fiendishly difficult to trace what the conflicting commands were.

To resolve the issue I had to compile my own EntityFramework!

The exception returning could easily contain more details about the currently executing Command to allow the user to debug what is causing the issue

Commented Issue: Entity Framework seems to change primary key values [2729]

$
0
0
Hi All,

I have a weird problem with Entity Framework 6.1.3 that is bugging me for almost a week now. I have added multiple POCO classes to an existing project, and all of the newly added classes experience the same problem. BTW, these are the first classes added since the upgrade from EF5 to EF6 but I don’t know if that is related to the problem.

One of them is, for instance, the following class with these primary key fields:

```
public class DataSource : BaseDataClass
{
[Key, Column(Order = 0)]
public virtual long FileId { … }

[Key, Column(Order = 1)]
public virtual long ContainerId { … }

[Key, Column(Order = 2)]
public virtual long Id { … }

…………
}
```
I then generated a code migration for the changes and updated the database. Now when I add an instance of this class to the DbContext with FileId = 0, ContainerId = 7 and Id = 1, the following SQL statement is send to the database (captured with SQL Profiler):
```
exec sp_executesql N'INSERT [dbo].[DataSources]([FileId], [ContainerId], [Id], [CoordinatesString], [DataSourceType], [Effective], [Equipment], [Location], [Name], [Owner], [SerialNumber], [TimeZone], [Vendor], [Version], [LastEditor], [LastEditDate])
VALUES (@0, @1, @2, NULL, @3, @4, @5, @6, @7, @8, @9, @10, @11, @12, @13, @14)
',N'@0 bigint,@1 bigint,@2 bigint,@3 int,@4 datetime2(7),@5 int,@6 nvarchar(100),@7 nvarchar(100),@8 nvarchar(100),@9 nvarchar(100),@10 nvarchar(100),@11 int,@12 nvarchar(100),@13 nvarchar(30),@14 datetime2(7)',@0=0,@1=7,@2=7,@3=1,@4='2015-02-22 12:21:22.0300000',@5=0,@6=N'',@7=N'Test 1',@8=N'',@9=N'',@10=N'',@11=8,@12=N'',@13=N'rpleijsier',@14='2015-04-03 12:30:42.3572469'
```
The problem is parameter @2 that holds the value of Id, at least it should but instead of 1 it has the value 7. After saving the changes to the database the value of Id is changed to 7 in my instance to.

If I add a second one but then with Id = 2, the query send to the database contains again a value of 7 instead of 2 and a duplicate record error will follow.

All added classes have the same problem and it is always the last value in the primary key that gets updated with the value of the second (in my case always the value of the ContainerId).

What I have tried so far:

1. The problem started with .NET 4.0 and EF6.1.2 so I tried updating to .NET 4.5.1. and EF6.1.3.
2. Changed the name of the property Id to RecordNumber because maybe Id has some special meaning.
3. Changed the name of property ContainerId to PukId for the same reason.
4. Changed the datatype of property Id so it was different from the datatype of ContainerId.
5. Used IDbCommandInterceptor to intercept the insert command just before it is send to the database and checked the interceptionContext ChangeTracker. The values off the added entries are correct, Id has the proper value here.
6. Added HasDatabaseGeneratedOption(DatabaseGeneratedOption.None) for the Id property.
7. And dozens of other small things.

Nothing seems to change this behavior.

Does anybody have an idea what I can do to get this problem solved? Thanks for any help on this.

Best regards,
Remko

Comments: Hello Andriy, Thank you for your answer. I am not able to create an example solution at the moment since this problem has cost me a lot of time and I am working against a deadline (July this year). In the meantime I discovered that when I create EntityTypeConfiguration classes for every class and do everything with fluent mappings instead of using data annotations, the problem is solved. When I have a bit more time I will try to create a minimal solution and upload it here. Best regards, remko

Commented Feature: Enable Include to issue multiple queries instead of JOINs [88]

$
0
0
This item was migrated from the DevDiv work item tracking system [ID=20480].

This work item originated from connect.microsoft.com. A member of the EF team at Microsoft should close the related Connect issue when closing this work item.

Comments: Include is slow because outer joins generate many columns, null for most rows, and because the core query is repeated for each .Include() that is concatenated. Sql Server's xml results solve both issues: SELECT *, (select * from Arms where Arms.PersonID = Person.Id for xml auto, type), (select * from Legs where Legs.PersonId = Person.Id for xml auto, type) from Persons

Commented Unassigned: No Lazy Loading in EF 6.1.3? [2740]

$
0
0
It looks like lazy loading doesn't work in EF 6.1.3.

I have created the smallest possible project to evaluate lazy loading. It can be [downloaded here](https://dl.dropboxusercontent.com/u/77113703/LazyLoadingTest.zip).

It shows that lazy loading is not working - although I have defined a navigation property as being virtual.

I'm baffled.

To see that the Country property is never loaded you need to debug the only available unit test in the project:

```
namespace LazyLoadingTest
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
using (MyContext ctx = new MyContext())
{
Person p = new Person("Axel", 1);

ctx.Persons.Add(p);
ctx.SaveChanges();

p = ctx.Persons.Find(1);

Assert.IsNotNull(p.Country);
}
}
}
}
```


This is the corresponding entity:

```
namespace LazyLoadingTest.EF.Entities
{
public class Person
{
public int Id { get; set; }
public string Name { get; set; }

public int CountryId { get; set; }
public virtual Country Country { get; set; }



public Person()
{ }

public Person(string name, int countryId)
{
Name = name;
CountryId = countryId;
}
}
}
```
Comments: I took a quick look at your project and I think the issue is that the country entities in your model are getting auto-generated ids that don't match the 1, 2, 3 id values you expect. You can avoid that by adding the annotation [DatabaseGenerated(DatabaseGeneratedOption.None)] on the Id or using the HasDatabaseGeneratedOption() API in OnModelCreating()

Commented Unassigned: No Lazy Loading in EF 6.1.3? [2740]

$
0
0
It looks like lazy loading doesn't work in EF 6.1.3.

I have created the smallest possible project to evaluate lazy loading. It can be [downloaded here](https://dl.dropboxusercontent.com/u/77113703/LazyLoadingTest.zip).

It shows that lazy loading is not working - although I have defined a navigation property as being virtual.

I'm baffled.

To see that the Country property is never loaded you need to debug the only available unit test in the project:

```
namespace LazyLoadingTest
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
using (MyContext ctx = new MyContext())
{
Person p = new Person("Axel", 1);

ctx.Persons.Add(p);
ctx.SaveChanges();

p = ctx.Persons.Find(1);

Assert.IsNotNull(p.Country);
}
}
}
}
```


This is the corresponding entity:

```
namespace LazyLoadingTest.EF.Entities
{
public class Person
{
public int Id { get; set; }
public string Name { get; set; }

public int CountryId { get; set; }
public virtual Country Country { get; set; }



public Person()
{ }

public Person(string name, int countryId)
{
Name = name;
CountryId = countryId;
}
}
}
```
Comments: Just to clarify, the reason it wouldn't work is that lazy loading will issue a query for countries with PK values that match the FK values you specified, and it won't find any. On the other hand I am a bit surprised that you are not getting referential constraint violations any time you try to add a Person with a CountryId that doesn't match an existing country, but I could only look at your code quickly so I may have missed some other detail.

Created Feature: Consider making DbContext.Entry() method (and other members of DbContext) virtual [2741]

$
0
0
Moving this from https://github.com/aspnet/EntityFramework/issues/2088

[@alisabzevari](https://github.com/alisabzevari) said:
> Many of methods in DbContext are virtual. So they can be mocked using Moq or similar frameworks. But Entry is not virtual. [Searching the net](http://www.asp.net/web-api/overview/testing-and-debugging/mocking-entity-framework-when-unit-testing-aspnet-web-api-2#dependency) made me accept that the better way to mock this method is to write a MarkAsModified method in our DbContext. I think this is not a clean way. Is it possible to make Entry method as virtual or create IDbContext interface?

Commented Unassigned: Collection is not loaded from cache using explicitly loading [2737]

$
0
0
__In short:__
Lazy navigation property to collection is not loaded from cache when data is available using explicitly loading (Load()). This behavior is not efficient and it is not consistent with lazy property to single object, that is loaded from cache in similar situation.

Can you optimize that and add to next release (e.g. 6.2.0)?

The following example is a section of a larger code that I cannot share. The names are chosen for this example. In real situation I have more relations = more explicitly loads (Load()) that are much more efficient than a multiple includes (Include()).

__Test (check configuration at the bottom)__
Tested on EF 6.1.3 and 6.0.2.
```
int[] carIds = new[] { 1, 2 }; // just for example

// database hit
List<DbCar> cars = DbContext.Cars
.Where(x => carIds.Contains(x.Id))
.ToList();

int[] definitionIds = cars.Select(c => c.DefinitionId).ToArray();

// database hit
DbContext.Devices
.Where(x => carIds.Contains(x.CarId))
.Load();

// database hit
DbContext.Definitions
.Where(x => definitionIds.Contains(x.DefinitionId))
.Load();

// OK: no database hit, data is loaded from cache (Load())
var definition = cars[0].Definition;

// FAIL: database hit! should be loaded from cache (Load())
var devices = cars[0].Devices;
```
__Workaround__
1. Remove "virtual" keyword from Devices in DbCar. Not so good solution for whole application.
2. Turn off lazy loading at the beginning (DbContext.LazyLoadingEnabled = false) and turn on at the end. Use try finally.

__Configuration__
```
// TPH
modelBuilder.Entity<DbCarDefinition>()
.Map<DbAudiDefinition>(m => m.Requires("type").HasValue(CarType.Audi.GetValue()))
...

// TPH
modelBuilder.Entity<DbCar>()
.Map<DbAudi>(m => m.Requires("type").HasValue(CarType.Audi.GetValue()))
...

// TPH
modelBuilder.Entity<DbDevice>()
.Map<DbRadioDevice>(m => m.Requires("type").HasValue(DeviceType.Radio.GetValue()))
...

modelBuilder.Entity<DbCar>()
.HasMany(x => x.Devices)
.WithRequired()
.HasForeignKey(x => x.CarId);

public abstract class DbCar
{
protected DbCar()
{
Devices = new List<DbDevice>();
}

[Key]
public int Id { get; set; }

public int DefinitionId { get; set; }

[ForeignKey("DefinitionId")]
public virtual DbCarDefinition Definition { get; set; }

public virtual List<DbDevice> Devices { get; set; }
}

public abstract class DbCarDefinition
{
[Key]
public int Id { get; set; }
}

public abstract class DbDevice
{
[Key]
public int Id { get; set; }

public int CarId { get; set; }
}
```
Comments: Consider another scenario, when second query has additive conditions: ``` DbContext.Devices .Where(x => carIds.Contains(x.CarId) && <<SomeCondition>>) .Load(); ``` In this case on access to cars[0].Devices, lazy loading mechanism must perform DB query to ensure collection items fully loaded. In your scrnario, where is point when EF known about collection consistency?

Created Unassigned: ef migration code based [2742]

$
0
0
Hello, I'm starting to turn migration manuals in my solution.
But I have a problem, it is several days that I could not understand.

My solution is divided into several projects, a project for the view (Sedna.UI) a project for the db where are my entity and my contexts. (Sedna.Domain).

I have 3 contexts, 2 have automatic migrations while the main one I would turn migration manual (SednaContext)

Nuget package manager console there is a dropdown and I select the Default project "Sedna.Domain" then when i run Enable-Migrations -ContextTypeName Sedna.Domain.UnitOfWork.SednaContext ... I get an error: "No migrations configuration type 'Sedna .Domain.Migrations.Configuration 'was found in the assembly "Sedna.Domain" "while I find him in the project.

I'm going crazy I do not understand why?
I have add a screencats

Commented Issue: Publishing to Azure still throwing NewSequentialId error [2107]

$
0
0
I'm trying to publish my EF 6 code first model to an Azure SQL database, and I'm getting the error below with NewSequentialId. From the last statement in work item # 614, it sounds like the app should see that it's Azure and use NewId instead of NewSequentialId. But it's not working for me. Am I just missing something obvious?

Error 4 Web deployment task failed. (Could not deploy package.
Warning SQL0: A project which specifies SQL Server 2012 as the target platform may experience compatibility issues with SQL Azure.
Error SQL72014: .Net SqlClient Data Provider: Msg 40511, Level 15, State 1, Line 2 Built-in function 'newsequentialid' is not supported in this version of SQL Server.


Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_EXECUTING_METHOD.) 0 0 HamonWeb

Comments: Same issue, I'm using EF6 Code first with Identity 2.2 and a very simple database that had no such issue until today.

Commented Unassigned: No Lazy Loading in EF 6.1.3? [2740]

$
0
0
It looks like lazy loading doesn't work in EF 6.1.3.

I have created the smallest possible project to evaluate lazy loading. It can be [downloaded here](https://dl.dropboxusercontent.com/u/77113703/LazyLoadingTest.zip).

It shows that lazy loading is not working - although I have defined a navigation property as being virtual.

I'm baffled.

To see that the Country property is never loaded you need to debug the only available unit test in the project:

```
namespace LazyLoadingTest
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
using (MyContext ctx = new MyContext())
{
Person p = new Person("Axel", 1);

ctx.Persons.Add(p);
ctx.SaveChanges();

p = ctx.Persons.Find(1);

Assert.IsNotNull(p.Country);
}
}
}
}
```


This is the corresponding entity:

```
namespace LazyLoadingTest.EF.Entities
{
public class Person
{
public int Id { get; set; }
public string Name { get; set; }

public int CountryId { get; set; }
public virtual Country Country { get; set; }



public Person()
{ }

public Person(string name, int countryId)
{
Name = name;
CountryId = countryId;
}
}
}
```
Comments: I think lazy loading won't happen here because the entity "p" is not a proxy. It is created with the "new" operator, added, and saved. Find then returns this same instance--it does not reload or re-create the entity instance. And hence it is still not a proxy and lazy loading will not kick in. To make it work, either - Dispose the context instance after SaveChanges and create a new context to re-query the entity, which will then be created by EF as a proxy. - Use the DbSet.Create method to create the entity instead of using the "new: operator. This allows EF to create a proxy instance. Even with all this, @divega might be right that the FK values may not match and nothing may be loaded.

Commented Unassigned: No Lazy Loading in EF 6.1.3? [2740]

$
0
0
It looks like lazy loading doesn't work in EF 6.1.3.

I have created the smallest possible project to evaluate lazy loading. It can be [downloaded here](https://dl.dropboxusercontent.com/u/77113703/LazyLoadingTest.zip).

It shows that lazy loading is not working - although I have defined a navigation property as being virtual.

I'm baffled.

To see that the Country property is never loaded you need to debug the only available unit test in the project:

```
namespace LazyLoadingTest
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
using (MyContext ctx = new MyContext())
{
Person p = new Person("Axel", 1);

ctx.Persons.Add(p);
ctx.SaveChanges();

p = ctx.Persons.Find(1);

Assert.IsNotNull(p.Country);
}
}
}
}
```


This is the corresponding entity:

```
namespace LazyLoadingTest.EF.Entities
{
public class Person
{
public int Id { get; set; }
public string Name { get; set; }

public int CountryId { get; set; }
public virtual Country Country { get; set; }



public Person()
{ }

public Person(string name, int countryId)
{
Name = name;
CountryId = countryId;
}
}
}
```
Comments: Thanks for taking the time. From what I can say, the missing foreign key assumption can positively be excluded. If that would be the case, __SaveChanges()__ would throw right from the beginning. If you download the full code, you will see that the __Seed()__ method creates the correct Ids. @ ajc: Thanks for providing me with those hints, but are you sure this is how lazy loading is supposed to work? This seems quite rigit to me. As you can see, I'm retrieving the __p__ variable from the __DbContext__, so the __new__ operator at the beginning doesn't actually count here.

Commented Unassigned: No Lazy Loading in EF 6.1.3? [2740]

$
0
0
It looks like lazy loading doesn't work in EF 6.1.3.

I have created the smallest possible project to evaluate lazy loading. It can be [downloaded here](https://dl.dropboxusercontent.com/u/77113703/LazyLoadingTest.zip).

It shows that lazy loading is not working - although I have defined a navigation property as being virtual.

I'm baffled.

To see that the Country property is never loaded you need to debug the only available unit test in the project:

```
namespace LazyLoadingTest
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
using (MyContext ctx = new MyContext())
{
Person p = new Person("Axel", 1);

ctx.Persons.Add(p);
ctx.SaveChanges();

p = ctx.Persons.Find(1);

Assert.IsNotNull(p.Country);
}
}
}
}
```


This is the corresponding entity:

```
namespace LazyLoadingTest.EF.Entities
{
public class Person
{
public int Id { get; set; }
public string Name { get; set; }

public int CountryId { get; set; }
public virtual Country Country { get; set; }



public Person()
{ }

public Person(string name, int countryId)
{
Name = name;
CountryId = countryId;
}
}
}
```
Comments: An entity instance with the given ID is being tracked by the context, so it is this tracked instance that is returned. And in this case that instance is the one created by "new" call in the code above.

Edited Unassigned: ef migration code based [2742]

$
0
0
Hello, I'm starting to turn migration manuals in my solution.
But I have a problem, it is several days that I could not understand.

My solution is divided into several projects, a project for the view (Sedna.UI) a project for the db where are my entity and my contexts. (Sedna.Domain).

I have 3 contexts, 2 have automatic migrations while the main one I would turn migration manual (SednaContext)

Nuget package manager console there is a dropdown and I select the Default project "Sedna.Domain" then when i run Enable-Migrations -ContextTypeName Sedna.Domain.UnitOfWork.SednaContext ... I get an error: "No migrations configuration type 'Sedna .Domain.Migrations.Configuration 'was found in the assembly "Sedna.Domain" "while I find him in the project.

I'm going crazy I do not understand why?
I have add a screencats


EDIT:
I noticed that the error was due because the project settings, in compilations was put x86, if I put AnyCPU work, why?
Viewing all 10318 articles
Browse latest View live




Latest Images