entity-framework-6

EF6 Oracle TimeStamp & Date

心已入冬 提交于 2019-12-12 01:43:47
问题 I'm starting to use EntityFramework 6 with Oracle (client 12.x). I have severals tables with DATE columns and TIMESTAMP columns. All queries generated by EF6 convert .NET DateTime type to TIMESTAMP. So the query performance is very poor. I tried to add a precision to 0 for the DATETIME columns but nothing changes on the generated query. Property(_ => _.MyDate).HasColumnName("DATE_COLUMN").HasPrecision(0); How can I specify in my code to translate my where clause by a TO_DATE function and not

Entity Framework Code First and Oracle ODAC 12c Release 3 Error

左心房为你撑大大i 提交于 2019-12-12 01:29:42
问题 A bit stumped with this one... I'm receiving the following error when setting up Code First on Entity Framework and Oracle... No Entity Framework provider found for the ADO.NET provider with invariant name 'Oracle.ManagedDataAccess.Client'. Make sure the provider is registered in the 'entityFramework' section of the application config file. With the following setup... Entity Framework 6.1.1 ODAC 12c Release 3 Any ideas on how to fix this problem? I've included the app.config file below... <

EntityFramework.SqlServer missing in release mode

余生长醉 提交于 2019-12-12 01:24:21
问题 I have several modules in my XAF Winforms application. The lowest tier makes use of Entity Framework 6.2 as installed by Nuget. The app runs fine in debug mode. However in release mode I get the following warning building. Severity Code Description Project File Line Suppression State Warning Could not resolve this reference. Could not locate the assembly "EntityFramework.SqlServer". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get

EF6 with new database generates 'The model backing the <Database> context has changed since the database was created.'

折月煮酒 提交于 2019-12-12 00:50:47
问题 I have been developing a Code First database via migrations for a couple of weeks. I added a few tables yesterday and got the error The model backing the 'DanceDb' context has changed since the database was created. After trying a couple of things I dropped the database, removed all code migrations, cleaned the solution, added a single migration and ran an Update-Database but I still get the same error. If I run Add-Migrations again, nothing is generated so something thinks they're the same.

Database first with EF6 SqlAnywhere provider in VS2017

孤街浪徒 提交于 2019-12-11 23:46:36
问题 Having already followed the advice in the SAP website documentation and installed the developer edition of SQLAnywhere 17, and also having manually run the installer for VS integration that is provided by this installation I still could not see any providers other than the MSSQL ones while creating an EF6 model in Visual Studio 2017. I found this https://www.nuget.org/packages/Sap.Data.SQLAnywhere.EF6/17.0.7.3399 Does anyone know where to find documentation on how to use it? Nuget provides no

Entity Framework Powertools Generating Views with Mysql and EF6

匆匆过客 提交于 2019-12-11 20:13:48
问题 I am using Entity Framework 6.1 with MySQL Server 5.5.35, and EF Powertools (latest version). I am able to run and use the framework fine and registered all the correct provider details in the application configuration file. Where I am having an issue is that I cannot use the right click Power tool function Generate Views, it keeps throwing up this exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Data.Entity.Core

Get field from dynamically/programatically named column name and Sum with EF

自古美人都是妖i 提交于 2019-12-11 19:55:02
问题 Today I done it here: Get field from dynamically/programatically named column name with Entity Framework I referrenced it because this question is very similiar to it. I would like to get all int values from specific column and sum them and return the value... I how can I do it? For Example: string column_name = "Col1"; int meterID = 6; As old method: "SELECT SUM( column_name ) FROM table_name Where MeterID = meterID ;" 回答1: If you have a class public class TableName { public int MeterId {

Windows Service: EF + MySql without app.config

浪尽此生 提交于 2019-12-11 19:47:07
问题 At the moment I'm writing a windows service. I'm already using EntityFramework with MSSQL database which is working perfectly. Now I have to use MySql parallely. But I can't manage to get it running ... I would like to avoid using the app.config and configure EntityFramework via the constructor of my class derived from DbContext. I have a SqlContext class: public class SqlContext : DbContext { public IDbSet<ServiceauftragSource> ServiceauftragSource { get; set; } public SqlContext(string

Using DbFunctions I get error: The specified type member 'Date' is not supported in LINQ to Entities

房东的猫 提交于 2019-12-11 19:37:46
问题 Using EF 6 when I run this code even using DbFunctions.TruncateTime var touches = analyticRepo.GetAll() .Where(x => DbFunctions.TruncateTime(x.DateCreated.Date) == report.DateCreated.Date); var test = touches.ToList(); I get this error: The specified type member 'Date' is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported. Any idea how to solve this. 回答1: You can pull the date up into a variable: var reportDate = report

Can I make my Entity Framework DbSet call my table valued function when selecting?

╄→гoц情女王★ 提交于 2019-12-11 18:27:59
问题 I have many existing queries that use DbSet<dbo_Deal> and now have the requirement to filter out confidential deals for unauthorized users. I would like to know if there's a way to override the DbSet<dbo_Deal> so that it selects using a Table Valued parameter instead of its default behavior. I created the following TVF that filters out confidential deals if the user does not have access: CREATE FUNCTION [dbo].[GetDeals](@UserKey int) RETURNS TABLE RETURN ( SELECT d.* FROM dbo.Deal d WHERE d