-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EF Core 6.0 release and breaking change notes #116
Conversation
Includes documentation on the timestamp handling changes. Closes npgsql#115
Original commit: 58a6507
Check this documentation: https://www.npgsql.org/efcore/release-notes/6.0.html#nodatime-changes Example codes: var currentDate = DateTimeOffset.UtcNow.DateTime;
// Specify the DateTimeKind here.
currentDate = DateTime.SpecifyKind(updatedAt, DateTimeKind.Utc);
// Your entity object, let's say you have a table named `employee`.
var employee = new Employee
{
Id = Guid.NewGuid(),
// Your `created_at` column with data type timestamp with time zone / timestamptz.
CreatedAt = currentDate
}
_dbContext.Employees.Add(employee);
_dbContext.SaveChanges(); |
@Tieantono please open a new issue with a runnable code sample rather than posting on this PR. FYI here's a minimal code sample which shows the above working with 6.0. Code sampleawait using var ctx = new EmployeeContext();
await ctx.Database.EnsureDeletedAsync();
await ctx.Database.EnsureCreatedAsync();
var currentDate = DateTime.UtcNow;
// Your entity object, let's say you have a table named `employee`.
var employee = new Employee
{
Id = Guid.NewGuid(),
// Your `created_at` column with data type timestamp with time zone / timestamptz.
CreatedAt = currentDate
};
ctx.Employees.Add(employee);
ctx.SaveChanges();
public class EmployeeContext : DbContext
{
public DbSet<Employee> Employees { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
=> optionsBuilder
.UseNpgsql(@"Host=localhost;Username=test;Password=test")
.LogTo(Console.WriteLine, LogLevel.Information)
.EnableSensitiveDataLogging();
}
public class Employee
{
public Guid Id { get; set; }
public string Name { get; set; }
public DateTime CreatedAt { get; set; }
} |
@roji Hi, I was just giving @Arth-OOZEE an example, not asking for a solution, but your example simpler than mine, I forgot that you could |
@Tieantono oh sorry, I missed that - thanks for helping out! @Arth-OOZEE please open a new issue if you continue to run into trouble. |
Includes documentation on the timestamp handling changes.
Closes #115
@vonzshik @NinoFloris this is the EF Core side of things - I will work on the ADO.NET notes later today.
(don't forget these are docs so we can always improve them later - we should merge these soon since that needs to happen before we release rc1)