Skip to content

Commit

Permalink
feat(nhibernate): make UserTypeMap public and expose maps as readonly
Browse files Browse the repository at this point in the history
  • Loading branch information
montyclt committed Feb 21, 2025
1 parent a1ea431 commit 71bfe07
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/ContractImplementations.NHibernate/UserTypeMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,21 @@

namespace IOKode.OpinionatedFramework.ContractImplementations.NHibernate;

internal struct UserTypeMap
public struct UserTypeMap
{
public Type ApplicationType { get; init; }
public Type NhUserType { get; init; }
}

public static class UserTypeMapper
{
private static readonly List<UserTypeMap> Maps = new();
private static readonly List<UserTypeMap> maps = new();

public static IReadOnlyList<UserTypeMap> Maps => maps;

public static void Add(Type applicationType, Type nhUserType)
{
Maps.Add(new UserTypeMap
maps.Add(new UserTypeMap
{
ApplicationType = applicationType,
NhUserType = nhUserType
Expand All @@ -41,6 +43,6 @@ public static void AddUserCollectionType<TApplicationType, TNhUserType>() where

public static Type? GetNhUserType(Type applicationType)
{
return Maps.Find(x => x.ApplicationType == applicationType).NhUserType;
return maps.Find(x => x.ApplicationType == applicationType).NhUserType;
}
}
2 changes: 1 addition & 1 deletion src/MSBuild/Base.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup Label="Build settings">
<TargetFramework>net8.0</TargetFramework>
<Version>0.14.0-dev</Version>
<Version>0.15.0-dev</Version>
<EnsuringVersion>1.2.2</EnsuringVersion>
<Nullable>enable</Nullable>
<AssemblyName>IOKode.OpinionatedFramework.$(MSBuildProjectName)</AssemblyName>
Expand Down

0 comments on commit 71bfe07

Please sign in to comment.