entity-framework

How to Refer to EntityFrameworkCore from Nuget Package source for a UWP Project

半腔热情 提交于 2020-04-17 20:28:11
问题 I downloaded .nupkg file from https://www.nuget.org/packages/Microsoft.EntityFrameworkCore/2.2.6 and added in the folder which I referred from the Nuget Package Sources. But it says that Microsoft.DependencyInjections 2.2.0 not Found. Then, I added the nupkg for MicrosoftDependencyInjections 2.2.0 from https://www.nuget.org/packages/Microsoft.Extensions.DependencyInjection/2.2.0 In runtime execution, it shows Microsoft.DependencyInjections 2.2.0 not found!. How to get rid of this issue, 来源:

How to Refer to EntityFrameworkCore from Nuget Package source for a UWP Project

北慕城南 提交于 2020-04-17 20:27:13
问题 I downloaded .nupkg file from https://www.nuget.org/packages/Microsoft.EntityFrameworkCore/2.2.6 and added in the folder which I referred from the Nuget Package Sources. But it says that Microsoft.DependencyInjections 2.2.0 not Found. Then, I added the nupkg for MicrosoftDependencyInjections 2.2.0 from https://www.nuget.org/packages/Microsoft.Extensions.DependencyInjection/2.2.0 In runtime execution, it shows Microsoft.DependencyInjections 2.2.0 not found!. How to get rid of this issue, 来源:

SQL query fails in EF Core

吃可爱长大的小学妹 提交于 2020-04-17 20:23:18
问题 I have a method in the repository (EF Core) that should produce a complex request to the database: public Task<List<Invoice>> GetOrderedVInvoicesAsync(string email, string lang, int rows, int offset) { return _contex.VInvoice.FromSqlInterpolated($"SELECT DocumentNumber,DocumentDate,DocumentReference,SerialNumber,ProductCode,Description,Certificate FROM vInvoice WHERE CHECKSUM(DocumentNumber + DocumentReference + CAST(DocumentDate AS VARCHAR)) IN (SELECT CHECKSUM(DocumentNumber +

Adding a second one-to-one relationship with the same table in entity framework

亡梦爱人 提交于 2020-04-17 10:03:31
问题 I am doing code-first entity framework design. I have a table, Account, which has a property, Supervisor: public class Account { public int Id { get; set; } public Account Supervisor { get; set; } } This works beautifully. However, I wish to add an alternate supervisor to the class: public class Account { public int Id { get; set; } public Account Supervisor { get; set; } public Account AlternateSupervisor { get; set; } } When I run Add-Migration AddAlternateSupervisor, the generated code

WPF with entity framework on net core - unable to create and object of type AppDbContext

怎甘沉沦 提交于 2020-04-16 03:55:29
问题 I have simple WPF Net Core app when i'm using entity framework, i have DbContext, but when i have add migration then i receive error: PM> add-migration init Build started... Build succeeded. Unable to create an object of type 'AppDbContext'. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728 my appsettings.json { "ConnectionStrings": { "SqlConnection": "Server=DESKTOP-K6R1EB3\\tester;Database=test;Trusted_Connection=True

How to use Linq in C# to select a specific string from multiple nested columns?

风格不统一 提交于 2020-04-16 02:40:11
问题 I have a small problem here. I have the following tables with their relations : Building Batteries Columns Elevators A building can have many batteries, batteries can have many columns, columns can have many elevators. A battery has one building, a column has one battery, an elevator has one column. If I were to do this var myintervention = _context.buildings.Where(b => b.batteries.Any(ba => ba.status == "Intervention")).ToList(); it would work perfectly fine in my query to return a list of

Entity Framework, TPT Inheritance and Multi-Language support

ε祈祈猫儿з 提交于 2020-04-15 17:17:04
问题 I have this DB Structure: Service Id int PK CategoryId FK SomeOtherFields LocalizedService LocalizedServiceId PK LanguageId FK Name Description As you can see, I have a base table called Service, and a LocalizedService table in which I'm writing multilingual data, such as name and description which should be translated in different languages. I have linked both tables in EF designer using TPT inheritance. Service is a base class of LocalizedService. The problem is that, TPT requires both

Entity Framework, TPT Inheritance and Multi-Language support

不问归期 提交于 2020-04-15 17:16:25
问题 I have this DB Structure: Service Id int PK CategoryId FK SomeOtherFields LocalizedService LocalizedServiceId PK LanguageId FK Name Description As you can see, I have a base table called Service, and a LocalizedService table in which I'm writing multilingual data, such as name and description which should be translated in different languages. I have linked both tables in EF designer using TPT inheritance. Service is a base class of LocalizedService. The problem is that, TPT requires both

None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type

瘦欲@ 提交于 2020-04-14 07:43:30
问题 I have read many questions about this problem on SO but I could not figure out what is the issue with my implementation. I am getting following exception: None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'SampleAuthTemplate.Domain.Entities.Core.Repositories.Concrete.EntityRepository`1[SampleAuthTemplate.Domain.Entities.Order]' can be invoked with the available services and parameters: ↵Cannot resolve parameter 'SampleAuthTemplate.Domain

None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type

大城市里の小女人 提交于 2020-04-14 07:43:09
问题 I have read many questions about this problem on SO but I could not figure out what is the issue with my implementation. I am getting following exception: None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'SampleAuthTemplate.Domain.Entities.Core.Repositories.Concrete.EntityRepository`1[SampleAuthTemplate.Domain.Entities.Order]' can be invoked with the available services and parameters: ↵Cannot resolve parameter 'SampleAuthTemplate.Domain