ef-core-2.1

Sandbox Sqlite with EF Core

戏子无情 提交于 2021-02-11 12:29:20
问题 I'm making a small web app which currently is using sqlite + EF Core 2.1 for storing data. Are there any solutions that I can sandbox my sqlite database file ? I mean to load my sqlite database with its data and triggers from my physical db file into memory. Everytime when I turn on/off VS debugger, database will be refreshed with my existing data in physical file . Thank you, 回答1: Here's some code that literally does what you asked: var sandboxConnection = new SqliteConnection("Data Source=

Server-side filtering with Angular 6 ag-grid and ASP.NET and EF Core 2.1

天涯浪子 提交于 2021-02-08 08:12:43
问题 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.log which is getting frustrating because of different information filterModel can provide which also makes mapping to server side classes very tedious. Has anyone found proper documentation about filterModel? Also, has anyone found helper methods for ASP.NET Core and EF Core to apply this filterModel?

Server-side filtering with Angular 6 ag-grid and ASP.NET and EF Core 2.1

…衆ロ難τιáo~ 提交于 2021-02-08 08:01:28
问题 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.log which is getting frustrating because of different information filterModel can provide which also makes mapping to server side classes very tedious. Has anyone found proper documentation about filterModel? Also, has anyone found helper methods for ASP.NET Core and EF Core to apply this filterModel?

Unexpected behaviour with Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ForEachAsync<T>()

送分小仙女□ 提交于 2021-02-07 14:49:27
问题 Here are the steps to reproduce. The below program copies 10,000 rows from one SQL table to another using .Net Core console app and EF Core. The program inserts records in 100 batches, and (this is important!) it creates a new instance of DbContext for each insert. 1) Create SQL Server database, and the "Froms" and "Tos" tables: create table Froms ( Id int identity(1, 1) not null, Guid [uniqueidentifier] not null, constraint [PK_Froms] primary key clustered (Id asc) ) go create table Tos ( Id

Unexpected behaviour with Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ForEachAsync<T>()

让人想犯罪 __ 提交于 2021-02-07 14:44:50
问题 Here are the steps to reproduce. The below program copies 10,000 rows from one SQL table to another using .Net Core console app and EF Core. The program inserts records in 100 batches, and (this is important!) it creates a new instance of DbContext for each insert. 1) Create SQL Server database, and the "Froms" and "Tos" tables: create table Froms ( Id int identity(1, 1) not null, Guid [uniqueidentifier] not null, constraint [PK_Froms] primary key clustered (Id asc) ) go create table Tos ( Id

Mapping stored procedure results to a custom class using EF Core FromSql returns instances with default values

时光总嘲笑我的痴心妄想 提交于 2021-01-29 19:00:38
问题 I have a stored procedure like this: CREATE PROCEDURE PLogin @pin varchar(50), @ipaddress varchar(50) AS BEGIN SET NOCOUNT ON; //Some code here ... SELECT * FROM [dbo].[QRelaceUzivatele_Aktivni] WHERE Pin = @pin AND IPAdresa=@ipaddress END I need to execute it from ASP MVC using EF Core 2.1. I have used the approach mentioned here. I have a custom C# class AktivniRelaceUzivatele that maps the fields of the QRelaceUzivatele_Aktivni view. public class AktivniRelaceUzivatele { int ProvozID { get

ShadowProperties being reached by foreach before being created

只谈情不闲聊 提交于 2021-01-28 05:04:44
问题 I'm new to Entity Framework and I'm learning atm with the Pluralsight courses from Julie Lerman. I'm watching the 2nd course "Entity Framework Core 2: Mappings" but I'm using EF Core 2.1. Edit: So I decided comment everything out and follow the course again and it is working now BUT the generated migration in generating 2 columns that shouldn't be there: protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn<DateTime>( name: "BetterName_Created", table:

In EF Core, how to check whether a migration is needed or not?

|▌冷眼眸甩不掉的悲伤 提交于 2021-01-26 03:52:13
问题 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 like to know if a migration is needed so that I can perform some other operations as well. Here is the context: public void Initialize() { using (var dbContext = new MyDbContext(m_dbContextOptions)) { --> bool isNeeded = demoTapeDbContext.Database.IsMigrationNeeded() demoTapeDbContext.Database

.Net Core 2 EF core connection string problem

回眸只為那壹抹淺笑 提交于 2020-12-13 03:41:28
问题 this is my appsettings.json "ConnectionStrings": { "Circolari": "Server=abcde;Database=Circolari;Trusted_Connection=True;" } and this is my startup.cs public Startup(IConfiguration configuration, IHostingEnvironment env) { Configuration = configuration; IConfigurationBuilder configurationBuilder = new ConfigurationBuilder() .SetBasePath(env.ContentRootPath) .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true); Configuration = configurationBuilder.Build(); } // This method

.Net Core 2 EF core connection string problem

ε祈祈猫儿з 提交于 2020-12-13 03:40:34
问题 this is my appsettings.json "ConnectionStrings": { "Circolari": "Server=abcde;Database=Circolari;Trusted_Connection=True;" } and this is my startup.cs public Startup(IConfiguration configuration, IHostingEnvironment env) { Configuration = configuration; IConfigurationBuilder configurationBuilder = new ConfigurationBuilder() .SetBasePath(env.ContentRootPath) .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true); Configuration = configurationBuilder.Build(); } // This method