ef-core-3.1

How can I use a collection on the data item row of my Windows Community Template datagrid as the Itemsource for a ComboBox column on the same row?

随声附和 提交于 2021-02-11 14:56:33
问题 How can I bind the ItemsSource of a Combobox column to a collection that is a sub-property of a property on the same row? In other words, the DataGrid is bound to a collection of items of a class the contains Property1 and Property2. So the DataGrid has two columns, Property1 and Property2. Property1 has a sub-property that is an Observable Collection. The column for Property2 is a Combobox column that should use Property1's Observable Collection as its ItemsSource. I'm loading the grid's

How do I remove most recent EFCore migration when SQLite provider cannot drop columns

人盡茶涼 提交于 2021-02-10 14:28:41
问题 This is a simple EFCore database in a .NETCore 3.1 app that has 3 migrations "init" Initial migration "gcalg500" Added seeding data and tables "valtt" Added more seeding data and tables The most recent one is still checked out in working code. But after I made it and ran a few times, I realized I wanted to undo it, make more changes and apply it again. so I tried remove-migration from the package manager console. The error returned was The migration '20200507181032_valtt' has already been

How do I remove most recent EFCore migration when SQLite provider cannot drop columns

时光毁灭记忆、已成空白 提交于 2021-02-10 14:28:38
问题 This is a simple EFCore database in a .NETCore 3.1 app that has 3 migrations "init" Initial migration "gcalg500" Added seeding data and tables "valtt" Added more seeding data and tables The most recent one is still checked out in working code. But after I made it and ran a few times, I realized I wanted to undo it, make more changes and apply it again. so I tried remove-migration from the package manager console. The error returned was The migration '20200507181032_valtt' has already been

Enable Sql Dependency in Application Insights on Azure Functions with EF Core

此生再无相见时 提交于 2021-02-08 06:25:15
问题 I have an Azure Function v3 application which uses Microsoft.EntityFrameworkCore 3.1.5 . I am not able to enable SQL Dependency tracking. Struggling with it 1 day already. To isolate the issue, I have created a standalone AzureFunction without EF. Instead of EF I was using Microsoft.Data.SqlClient 1.0.19269.1 which is also used by EF. Here goes the function: public static class Function1 { [FunctionName("Function1")] public static async Task<IActionResult> Run( [HttpTrigger(AuthorizationLevel

Can I clone DbContext from existing one?

烂漫一生 提交于 2021-02-05 11:59:24
问题 I'm working on .NET Core Web API and I have one endpoint where I want to run three operations in parallel. All three of them use the same database, so I need three copies of DbContext. I created a simple Factory class, which I later inject into my "Data" class. Is it possible (if it's, is a good practice), to inject DbContext into my factory class (using built in .NET Core IoC) and when someone calls "CreateMyDbContext" method, just deep clone the one which was injected at the beginning? EDIT

Can I clone DbContext from existing one?

你离开我真会死。 提交于 2021-02-05 11:59:22
问题 I'm working on .NET Core Web API and I have one endpoint where I want to run three operations in parallel. All three of them use the same database, so I need three copies of DbContext. I created a simple Factory class, which I later inject into my "Data" class. Is it possible (if it's, is a good practice), to inject DbContext into my factory class (using built in .NET Core IoC) and when someone calls "CreateMyDbContext" method, just deep clone the one which was injected at the beginning? EDIT

What is required for EF Core's IMethodCallTranslator to work with `EF.Functions` to provide a custom function?

天涯浪子 提交于 2021-01-29 13:28:59
问题 I'm trying to implement a custom IMethodCallTranslator in EF Core 3.1 with the Sqlite provider. I have created: An extension method off of this DbFunctions which is called at query time An implementation of IMethodCallTranslator which is Translate not called A derived RelationalMethodCallTranslatorProvider which I'm passing an instance of my IMethodCallTranslator . This constructor is hit. I also tried overriding RelationalMethodCallTranslatorProvider.Translate and this was not hit. An

EFCore 3.1 - Exists query via Any; Query cannot be translated

孤街醉人 提交于 2021-01-27 11:20:38
问题 We're using EFCore 3.1 and trying to build a query using Exists by means of .Any() which spans 2 properties. var selectionCriteria = someHugeList.Select(sh => new { sh.Id, sh.StatusCode }).ToList() var resultsQry = _myContext.SomeClass .Include(sc => sc.DetailRecords) .Where(sc => selectionCriteria.Any(crit => crit.Id == sc.Id && crit.StatusCode == sc.StatusCode)); var results = await resultsQry.ToListAsync() When running this query (even with a small amount (5 items) of selection criteria

EFCore 3.1 - Exists query via Any; Query cannot be translated

丶灬走出姿态 提交于 2021-01-27 11:20:07
问题 We're using EFCore 3.1 and trying to build a query using Exists by means of .Any() which spans 2 properties. var selectionCriteria = someHugeList.Select(sh => new { sh.Id, sh.StatusCode }).ToList() var resultsQry = _myContext.SomeClass .Include(sc => sc.DetailRecords) .Where(sc => selectionCriteria.Any(crit => crit.Id == sc.Id && crit.StatusCode == sc.StatusCode)); var results = await resultsQry.ToListAsync() When running this query (even with a small amount (5 items) of selection criteria

EFCore 3.1 - Exists query via Any; Query cannot be translated

偶尔善良 提交于 2021-01-27 11:17:09
问题 We're using EFCore 3.1 and trying to build a query using Exists by means of .Any() which spans 2 properties. var selectionCriteria = someHugeList.Select(sh => new { sh.Id, sh.StatusCode }).ToList() var resultsQry = _myContext.SomeClass .Include(sc => sc.DetailRecords) .Where(sc => selectionCriteria.Any(crit => crit.Id == sc.Id && crit.StatusCode == sc.StatusCode)); var results = await resultsQry.ToListAsync() When running this query (even with a small amount (5 items) of selection criteria