ef-core-2.1 Questions

4

Solved

I have researched this and always found examples like this: var blogs = context.Blogs .FromSql("SELECT * FROM dbo.Blogs") .ToList(); The problem is, I don't want to run my raw SQL on the Blogs...
Weismannism asked 28/11, 2018 at 10:39

5

I am creating SQLite In Memory database for unit testing: var connection = new SqliteConnection("DataSource=:memory:"); connection.Open(); try { var options = new DbContextOptionsBuilder<...
Escarp asked 30/11, 2018 at 15:33

2

There is a ton of info on setting the behavior for delete actions for foreign key relationships in Entity Framework Core, however, I have found nearly zero details on how to specify the "On Update ...
Electrokinetics asked 1/8, 2018 at 19:40

2

Solved

Using EF-Core for PostgresSQL, I have an entity with a field of type byte but decided to change it to type byte[]. But when I do migrations, on applying the migration file generated, it threw the f...
Horary asked 23/9, 2018 at 4:7

2

In our system we ran into performance problems while using QueryFilters in EF core. The problem is that EF core filters inside a LEFT JOIN instead of doing the filtering outside of it. The generat...
Innominate asked 19/3, 2019 at 10:35

4

Solved

I am getting this warning in my ASP.NET Core 2.2 application warn: Microsoft.EntityFrameworkCore.Infrastructure[10402] More than twenty 'IServiceProvider' instances have been created for internal ...
Spectrometer asked 3/2, 2020 at 21:32

17

I am using EF Core 2.1 This was my initial model definition. public class Customer //Parent { public int Id { get; set; } public string Name { get; set; } public string Email { get; set; } ...

3

Solved

Looking forward to build a framework, (No repository pattern to working with DbSets directly) to autopopulate Created and last modified automatically, rather than spitting out these codes through o...
Sprightly asked 7/11, 2018 at 9:59

25

Solved

Does any one know how I can specify the Default value for a DateTime property using the System.ComponentModel DefaultValue Attribute? for example I try this: [DefaultValue(typeof(DateTime),DateTime...
Thinia asked 27/3, 2009 at 18:49

3

Solved

I am using Entity Framework Core in an Xamarin.iOS application. In my core project that contains code (.netstandard 2.0) that is shared between the iOS application and other applications, I would...
Timbering asked 24/1, 2019 at 23:35

8

Solved

I'm using ASP.NET Core 2.2 and I'm using model binding for uploading file. This is my UserViewModel public class UserViewModel { [Required(ErrorMessage = "Please select a file.")] [DataType(Da...
Sylvanite asked 13/6, 2019 at 21:40

2

Solved

I'm using Asp.Net Core 2.1, Mvc, c#, EF Core with Code First and Migrations. I'm trying to build a table that has a composite primary key in the Migration.Up() method: migrationBuilder.CreateTa...

6

Solved

I am trying to seed an user entity in my database. The User entity has an owend property EmailPermissions. When I run the command dotnet ef migrations add Initial; I get the error The see...
Barbuto asked 14/6, 2018 at 16:58

7

Solved

I have an ASP.NET Core 2.1.0 application using EF Core 2.1.0. How do I go about seeding the database with Admin user and give him/her an Admin role? I cannot find any documentation on this.
Millennium asked 10/6, 2018 at 15:2

2

Solved

Seems simple but I can't figure out how to tell EF core not to create the primary key of an entity with an auto-incrementing identity column. I want to insert my own primary key values myself. I re...
Bushed asked 16/9, 2018 at 0:10

2

I am using .Net Core 2.1 and EF Core 2.1. I successfully created 2 tables with EF Code First Migrations and dotnet CLI also seeded data into it. However when I try to add a new model Feature, and r...
Hoard asked 6/9, 2018 at 6:57

3

I am getting a strange behavior of seeded roles on every migration. No matter what changes you have made, migration will delete the seeded roles and will insert them again. Migration given below is...

3

I am trying to implement server-side filtering in ag-grid (infinite scrolling mode). Problem is - documentation about filterModel is very obscure and I am slowly discovering things using console....
Embalm asked 18/9, 2018 at 15:48

4

this is my appsettings.json "ConnectionStrings": { "Circolari": "Server=abcde;Database=Circolari;Trusted_Connection=True;" } and this is my startup.cs public Startup(IConfiguration configur...
Disconcerted asked 5/10, 2018 at 6:49

2

I am using EF Core Power Tools version 2.4.0 with Miccrosoft.EntifyFrameworkCore.SqlServer version 2.2.6 I have SQL table column IsActive defined as [IsActive] [bit] NOT NULL I use EF Core Power T...
Deva asked 26/2, 2020 at 17:9

3

Solved

I am developing an Angular 6 application in dotNet Core 2.1. Everything is working flawlessly, until I got to setting up EFCore. All my models are defined and context created. Running dotnet ef mig...
Hasin asked 18/11, 2018 at 10:9

3

Solved

I've got the following data layer setup: public class Repository : IRepository { private readonly MyDbContext _dbContext; public List<Meter> Search(Expression<Func<Meter,bool>&g...
Krishna asked 29/9, 2019 at 15:58

2

I'm using netcoreapp 2.1 with EF Core 2.1 and updating my database with data migrations and have come into a problem with renaming tables. My main issue here is a table (and later potentially colum...
Diminution asked 26/7, 2018 at 8:36

6

I have dbContext.Items.FromSql("SELECT COUNT(*) FROM Items WHERE JSON_VALUE(Column, '$.json') = 'abc'") This returns an IQueryable, I am wondering how I can return a scalar int back?
Pozzuoli asked 6/11, 2018 at 20:14

3

Solved

I am really new to EF (using EF core 2.1) and have been following a bunch of tutorials so far, but now I have ventred in to creating my own DB structure and stumbled when trying to add a value in t...
Korwin asked 3/5, 2019 at 22:14

© 2022 - 2024 — McMap. All rights reserved.