Comments (1)
I think that would be not be considered a responsibility of this library. At the very least it would probably need to be added as a separate project/package to keep things clean. That being said, it should be fairly straight forward for someone to implement this functionality on their own by using something similar to the following:
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.SqlServer.Storage;
using NodaTime;
namespace SimplerSoftware.EntityFrameworkCore.SqlServer.NodaTime.Extensions
{
public static class ModelBuilderExtensions
{
public static void ApplyConvertersToProperties(this ModelBuilder modelBuilder)
{
foreach (var model in modelBuilder.Model.GetEntityTypes())
{
foreach (var property in model.GetProperties())
{
if (property.ClrType == typeof(Instant) || property.ClrType == typeof(Instant?))
{
property.SetValueConverter(new InstantValueConverter());
}
else if (property.ClrType == typeof(LocalDate) || property.ClrType == typeof(LocalDate?))
{
property.SetValueConverter(new LocalDateValueConverter());
}
else if (property.ClrType == typeof(LocalDateTime) || property.ClrType == typeof(LocalDateTime?))
{
property.SetValueConverter(new LocalDateTimeValueConverter());
}
else if (property.ClrType == typeof(LocalTime) || property.ClrType == typeof(LocalTime?))
{
property.SetValueConverter(new LocalTimeValueConverter());
}
else if (property.ClrType == typeof(Duration) || property.ClrType == typeof(Duration?))
{
property.SetValueConverter(new DurationValueConverter());
}
}
}
}
}
}
None of this has been tested so use at your own risk ;)
from efcore.sqlserver.nodatime.
Related Issues (20)
- Exception due to invalid culture name in assembly HOT 1
- Support for Entity Framework Core 5
- SqlDateTime overflow exception persisting default values
- SQL for Test Database HOT 1
- Enable design time support HOT 3
- Are standard operators supported? HOT 1
- CLR type for Noda Time types HOT 4
- Any plans to support ZonedDateTime? HOT 4
- Support for .NET 6 HOT 4
- Queries using (DateTime).Date fail to translate HOT 5
- .NET6 tests with WebApplicationFactory don't respect "UseNoda()" extension HOT 6
- ArgumentNullException with DbContextOptionsBuilder with UseInternalServiceProvider HOT 3
- Fix example with Year() in README HOT 2
- Support for EFCore 7 HOT 6
- Updated to Latest Release and UseNodaTime is Not Working HOT 4
- Support fot LocalDateTime.Date part HOT 1
- LocalDateTime being stored as UTC Date in DB HOT 1
- Duration with values >= 24h HOT 2
- Support for compiled models
- Filtering using Contains throws UnreachableException HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from efcore.sqlserver.nodatime.