SkillAgentSearch skills...

EntityFrameworkCore.SqlServer.NodaTime

NodaTime extension for the Microsoft SQL Server database provider for Entity Framework Core

Install / Use

/learn @jpd30/EntityFrameworkCore.SqlServer.NodaTime
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Repository

This repository is home to the following project. This project is maintained by Jon Davies and licensed under the Apache Licence, Version 2.0.

  • [EntityFrameworkCore.SqlServer.NodaTime]

EntityFrameworkCore.SqlServer.NodaTime

Installation

EF Core SqlServer NodaTime will be available on NuGet. Install the project, along with the SQL Server database provider and underlying EF Core packages.

dotnet add package EntityFrameworkCore.SqlServer.NodaTime

Use the --version option to specify a preview version to install.

Usage

The following code demonstrates a simple entity and DbContext making use of EF Core SQL Server NodaTime.

class MyEntity
{
    public int Id { get; set; }
    public Instant Instant { get; set; }
    public LocalDate LocalDate { get; set; }
    public LocalTime LocalTime { get; set; }
    public LocalDateTime LocalDateTime { get; set; }
    public OffsetDateTime OffsetDateTime { get; set; }
}

class MyContext : DbContext
{
    public DbSet<MyEntity> MyEntities { get; set; }

    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
        optionsBuilder.UseSqlServer(
            @"Server=(LocalDB)\MSSQLLocalDB;Initial Catalog=SqlServerNodaTime",
            options => options.UseNodaTime()
        );
    }
}

Related Skills

View on GitHub
GitHub Stars7
CategoryData
Updated1y ago
Forks3

Languages

C#

Security Score

70/100

Audited on Oct 13, 2024

No findings