SimplifyNet / Simplify

Simplify is an open-source set of lightweight .NET libraries that provide infrastructure for your applications. DI and mocking friendly.

Home Page:https://simplifynet.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add records support for base classes in GenericRepository

hardcoder opened this issue · comments

Is your feature request related to a problem? Please describe.
Could not inherit record type from class.

Describe the solution you'd like
For example, inherit CustomRecord from IdentityRecord.

Describe alternatives you've considered
Just a new record type, delivered with C# 9.0.

Additional context

Inheriting from record in nuget-package works well. Checked by creating test package Nucleus contaning ExampleRecord type. Record type inheritance works as expected in projects targeting .NET Framework 4.8 / .NET Core 3.1 / .NET 5.0. (Test project)

FluentNHibernate throws exception:
FluentNHibernate.Cfg.FluentConfigurationException: An invalid or incomplete configuration was used while creating a SessionFactory.
NHibernate.InvalidProxyTypeException: The following types may not be used as proxies:
{TypeFullName here}: method Equals should be 'public/protected virtual' or 'protected internal virtual'

Can't be done in NHibernate.
To prevent object change ReadOnly option can be used: https://stackoverflow.com/a/2871277/550882