zzz projects Entity Framework 6 EF 6
Home EF Core Articles Knowledge Base Online Examples
  • Home
  • EF Core
  • Articles
  • Knowledge Base
  • Online Examples

Entity Framework 6 - Knowledge Base (KB)

26 results in tag: datetime

Date time and SQL Server 2008 and SQL Server 2005

I've built a entity framework model against a 2008 database. All works ok against the 2008 database. When I try to update the entity on a 2005 database I get this error. ...The version of SQL Server in use does not support datatype 'datetime2...I speci...
datetime datetime2 entity-framework sql-server-2005 sql-server-2008
asked by Monroecheeseman

For subtracting two dates, use LINQ to Entities.

I am trying to determine the number of days between 2 dates using LINQ with Entity Framework. It is telling me that it does not recognize Subtract on the System.TimeSpan class...Here is my where portion of the LINQ query....where ((DateTime.Now.Subtract(v...
datetime entity-framework linq-to-entities
asked by Michael I

When converting a datetime2 data type to a datetime data type, an out-of-range value is returned.

I've got a datatable with 5 columns, where a row is being filled with data then saved to the database via a transaction....While saving, an error is returned:...The conversion of a datetime2 data type to a datetime data type resulted in an out-of-range va...
c# datetime entity-framework orm sql-server
asked by Gerbrand

When converting a datetime2 data type to a datetime data type, an out-of-range value was returned.

I have an ASP.NET MVC application where I am editing an existing database to update a paticular field, ...DateTime.... My database has 4 fields, two of which are ...DateCreated... and ...DateModified.... When I try to update the field, I want to keep ...D...
asp.net-mvc datetime entity-framework
asked by Anthony Forloney

EntityFramework DateTime Linq

In my application I am using Entity Framework. ...My Table...-Article -period -startDate ...I need records that match => ...DateTime.Now > startDate and (startDate + period) > DateTime.Now...I tried this code but its now working ...Context.Article .Wh...
c# datetime entity-framework linq
asked by Yucel

DateTime and UTC in Entity Framework

Is it possible to have Entity Framework (I am using the Code First Approach with CTP5 currently) store all DateTime values as UTC in the database?...Or is there maybe a way to specify it in the mapping, for example in this one for the last_login column:..
c# code-first datetime entity-framework utc
asked by Fionn

How to use DateTime.AddDays(x) in Entity Framework

I have this code:...from pr in e.ProgramSetup.Include("Program").Include("Program.Client") where pr.DateBegin < DateTime.Now && pr.DateEnd > DateTime.Now.AddDays(pr.DateEndOffset) select pr).ToList(); ...It does not work, because AddDays(...
c# datetime entity-framework linq-to-entities
asked by Zdenek G

Linq where clause compare only date value without time value

var _My_ResetSet_Array = _DB .tbl_MyTable .Where(x => x.Active == true && x.DateTimeValueColumn <= DateTime.Now) .Select(x => x); ...Upper query is working correct.... But I want to check only date value only.... But upper query check...
c# compare datetime entity-framework linq-to-entities
asked by Frank Myat Thu

Compare Dates using LINQ to Entities (Entity Framework)

I need to return a list of items from my database that expire at a pre-specified time on the date supplied by the item. My ...erroneous... code is as follows:...return All().Where(o => new DateTime(o.expiry_date.Year, o.expiry_date.Month, o.expiry_date.Da...
c# datetime entity-framework
asked by Jimbo

Why does EF5 code first use datetime2 when inserting a nullable datetime into the database?

I am saving a Cart object to the database that has a nullable datetime. This is the error I get: ...The conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value....There are quite a few stackoverflow posts documentin...
datetime datetime2 ef-code-first entity-framework
asked by Matt R

DateTime format with Entity Framework

Can someone explain how it works? I need compare a DateTime in SQL Server with an user input....Here an example of what I'm looking for:...DateTime[] dates = { DateTime.Now, DateTime.UtcNow }; Console.WriteLine(dates.Where(x => x < DateTime.Now)); // I...
c# datetime entity-framework
asked by user2195741

How we survive using a local time zone with Breeze

I'm writing this to gather comments on our approaches and hopefully help someone else (and my memory)....Scenario...All of our databases use ...DateTime... data types with no time zone information. ...Internally we know that all of the dates/times in our ...
asp.net-web-api breeze datetime entity-framework timezone
asked by Brendan

The conversion of a datetime2 data type to a datetime data type Error

I have a controller:...[HttpPost] public ActionResult Create(Auction auction) { var db = new EbuyDataContext(); db.Auctions.Add(auction); db.SaveChanges(); return View(auction); } ...A model:...public class Auction { public long Id...
asp.net-mvc c# datetime entity-framework
asked by Alexandra Orlov

How to implement a DateTime entity property to set always DateTime.Now

I've read a bunch about auto implemented properties but I still don't quite get it. I have and entity:... public class News { public int NewsId { get; set; } public string Title { get; set; } public string Content { get; set; }...
c# datetime entity-framework properties
asked by Leron_says_get_back_Monica

LINQ Query to Convert string to datetime

I want to convert the string value to date time ...Class...public class demoDate { public DateTime DueDate; public int OrderReportID; public DateTime _DueDate { get { return DueDate; } set { DueDate = value; } } ...
.net c# datetime entity-framework linq
asked by Golda

In LINQ Query convert the string to datetime and check with today's date

In Table, DueDate data type is varchar. Now I want to check the due date with today's date... var query = (from o in db.Order_Reports where Convert.ToDateTime(o.ReportDueDateTime) >= DateTime.Now select o); ...The error...LINQ ...
c# datetime entity-framework linq
asked by Golda

Storing DateTime property instead of byte array in SQL table using Code-First MVC5 EF6

When I try to initialize my database using EF6 in MVC5 I get the error: ...The property 'Timestamp' is not a Byte array. IsRowVersion can only be configured for Byte array properties.... Is there a way I can override the IsRowVersion using FluentAPI or is...
asp.net-mvc-5 c# datetime entity-framework-6 sql
asked by yardpenalty.com

Nullable DateTime property in Entity Framework 6 thows exception on save when value is null

I have defined a Nullable ...DateTime...property in one of my classes:...public DateTime? ControlDate { get; set; } ...When using EF 6 CodeFirst to generate the database (SQL Server 2008) from my model I get:...The problem is that when I save my instance ...
.net c# datetime entity-framework-6
asked by Adolfo Perez

OrderBy & OrderByDescending DateTime In Generic Repository?

In my Solution, create Generic Repository... public abstract class GenericRepository<C,T> : Repo.IGenericRepository<T> where T : class where C : DbContext, new(){ private C _entities = new C(); public C Context { ...
c# datetime entity-framework-6 repository
asked by jupeter

How can I compare a nullable type date using user entered date?

I can't find how to compare a date entered by a user to a date on a table created by EF6. I'm using LINQ Extensions to search the DB and have tried multiple suggestions that compile, but fail during execution....User Input:...DateTime userdate; DateTime.T...
c# datetime entity-framework entity-framework-6
asked by Alex Bello

Page 1 of 2
  • 1
  • 2
  • »

Prime Library

Performance

  • Entity Framework Extensions
  • Entity Framework Classic
  • Bulk Operations
  • Dapper Plus

Expression Evaluator

  • C# Eval Expression
  • SQL Eval Function
More Projects...

Related

  • EF Extensions Online Benchmark
  • WIN an EF Extensions license
  • EF6 BatchSaveChanges for only $79
Save your entities 20× faster with EF Extensions
SaveChanges vs BulkSaveChanges

EF Extensions
Try for free now
Get monthly updates by subscribing to our newsletter!
SUBSCRIBE!