entity-framework

“Specified type is not registered” error when bulk inserting table with geospatial data types

与世无争的帅哥 提交于 2021-02-20 17:56:41
问题 I'm trying to use the SqlBulkCopy class from the System.Data assembly (4.6.1) to bulk insert a table with a geospatial data type, using code that looks roughly like this (adapted from https://github.com/MikaelEliasson/EntityFramework.Utilities): public void InsertItems<T>(IEnumerable<T> items, string schema, string tableName, IList<ColumnMapping> properties, DbConnection storeConnection, int? batchSize) { using (var reader = new EFDataReader<T>(items, properties)) { var con = (SqlConnection

“Specified type is not registered” error when bulk inserting table with geospatial data types

*爱你&永不变心* 提交于 2021-02-20 17:56:04
问题 I'm trying to use the SqlBulkCopy class from the System.Data assembly (4.6.1) to bulk insert a table with a geospatial data type, using code that looks roughly like this (adapted from https://github.com/MikaelEliasson/EntityFramework.Utilities): public void InsertItems<T>(IEnumerable<T> items, string schema, string tableName, IList<ColumnMapping> properties, DbConnection storeConnection, int? batchSize) { using (var reader = new EFDataReader<T>(items, properties)) { var con = (SqlConnection

How can I add and use new column in abpfeature table and access it in boilerplate?

情到浓时终转凉″ 提交于 2021-02-20 09:43:26
问题 I'm using asp.net zero build on boilerplate and I want to extend my table of feature, but I couldn't access feature table like other normal tables which I've created. Can anyone help? 回答1: I was facing your problem with another table AuditLogs , and I finally managed to solve it using EF Core features. You can find my issue and its solution here The solution is lying on the concept of inheritance in EF Core. Basically, you can create a new class namely " ExtendedFeature " derived from

Pass LINQ expression as parameter to where clause

心已入冬 提交于 2021-02-20 05:18:31
问题 Please read the question carefully before voting to close it. That is not a duplicate. I am trying to build a generic method that returns list of entities of type T joined to logs of type AuditLog. Here is a LEFT JOIN interpretation in LINQ that I use var result = from entity in entitySet from auditLog in auditLogSet.Where(joinExpression).DefaultIfEmpty() select new { entity, auditLog }; return result.GroupBy(item => item.entity) .Select(group => new { Entity = group.Key, Logs = group.Where(i

Entity Framework and ASP.NET MVC 5 How can I push selected checkoxes into my localDB?

一曲冷凌霜 提交于 2021-02-20 04:45:25
问题 I am having troubles with pushing selected checkboxes into the table. I have three tables - Employees , Projects and EmployeeProject . For one Employee I want to be able to choose multiple projects. I already created a create view with inputs for name of the employee and checkboxes of the projects. How can I send data to the EmployeeProjects table? So I could display it later. My models: public class Employee { [Key] public int Id { get; set; } public string FirstName { get; set; } public

Entity Framework and ASP.NET MVC 5 How can I push selected checkoxes into my localDB?

只愿长相守 提交于 2021-02-20 04:45:06
问题 I am having troubles with pushing selected checkboxes into the table. I have three tables - Employees , Projects and EmployeeProject . For one Employee I want to be able to choose multiple projects. I already created a create view with inputs for name of the employee and checkboxes of the projects. How can I send data to the EmployeeProjects table? So I could display it later. My models: public class Employee { [Key] public int Id { get; set; } public string FirstName { get; set; } public

How can I switch the database provider used by EF Core based on configuration?

孤者浪人 提交于 2021-02-20 00:25:51
问题 EF Core supports a lot of different providers and I can configure them in Startup.cs by specifying the provider. For example, if I want to use SQL Server, I can use: services.AddDbContext<SomeContext>(options => { options.UseSqlServer(Configuration.GetConnectionString("SomeDatabase")); }); But the DB provider (SQL Server) seems to be hard-coded here. What I want to achieve is set the DB provider based on configuration so I can switch the DB provider based on configuration. Is there a way to

How can I switch the database provider used by EF Core based on configuration?

妖精的绣舞 提交于 2021-02-20 00:25:34
问题 EF Core supports a lot of different providers and I can configure them in Startup.cs by specifying the provider. For example, if I want to use SQL Server, I can use: services.AddDbContext<SomeContext>(options => { options.UseSqlServer(Configuration.GetConnectionString("SomeDatabase")); }); But the DB provider (SQL Server) seems to be hard-coded here. What I want to achieve is set the DB provider based on configuration so I can switch the DB provider based on configuration. Is there a way to

How can I switch the database provider used by EF Core based on configuration?

限于喜欢 提交于 2021-02-20 00:24:53
问题 EF Core supports a lot of different providers and I can configure them in Startup.cs by specifying the provider. For example, if I want to use SQL Server, I can use: services.AddDbContext<SomeContext>(options => { options.UseSqlServer(Configuration.GetConnectionString("SomeDatabase")); }); But the DB provider (SQL Server) seems to be hard-coded here. What I want to achieve is set the DB provider based on configuration so I can switch the DB provider based on configuration. Is there a way to

How can I switch the database provider used by EF Core based on configuration?

主宰稳场 提交于 2021-02-20 00:22:45
问题 EF Core supports a lot of different providers and I can configure them in Startup.cs by specifying the provider. For example, if I want to use SQL Server, I can use: services.AddDbContext<SomeContext>(options => { options.UseSqlServer(Configuration.GetConnectionString("SomeDatabase")); }); But the DB provider (SQL Server) seems to be hard-coded here. What I want to achieve is set the DB provider based on configuration so I can switch the DB provider based on configuration. Is there a way to