Skip to content

Commit ff2039e

Browse files
committed
up version
1 parent 8897ea1 commit ff2039e

File tree

2 files changed

+11
-17
lines changed

2 files changed

+11
-17
lines changed

FastCloner.Tests/DbTests.cs

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,14 @@ public class DbTests
2222
[OneTimeSetUp]
2323
public void SetUp()
2424
{
25-
// Smažeme existující databázi, pokud existuje
2625
if (File.Exists(DbFile))
2726
{
2827
File.Delete(DbFile);
2928
}
3029

3130
Configuration configuration = CreateConfiguration();
3231
sessionFactory = configuration.BuildSessionFactory();
33-
34-
// Vytvoříme schéma databáze
32+
3533
using (ISession? session = sessionFactory.OpenSession())
3634
{
3735
SchemaExport export = new SchemaExport(configuration);
@@ -42,7 +40,7 @@ public void SetUp()
4240
[OneTimeTearDown]
4341
public void TearDown()
4442
{
45-
sessionFactory?.Dispose();
43+
sessionFactory.Dispose();
4644

4745
if (File.Exists(DbFile))
4846
{
@@ -80,7 +78,7 @@ public class EntityMap : ClassMap<Entity>
8078
{
8179
public EntityMap()
8280
{
83-
Table("Entities"); // Změněno z "Entity"
81+
Table("Entities");
8482
Id(x => x.Id).GeneratedBy.Identity();
8583
Map(x => x.Name);
8684
HasMany(x => x.Children)
@@ -94,7 +92,7 @@ public class ChildEntityMap : ClassMap<ChildEntity>
9492
{
9593
public ChildEntityMap()
9694
{
97-
Table("ChildEntities"); // Změněno z "ChildEntity"
95+
Table("ChildEntities");
9896
Id(x => x.Id).GeneratedBy.Identity();
9997
Map(x => x.Name);
10098
References(x => x.Entity)
@@ -153,17 +151,13 @@ public void Test_CloneNHibernateProxy()
153151

154152
public static class NHibernateHelper
155153
{
156-
public static T Unproxy<T>(T entity) where T : class
154+
public static T? Unproxy<T>(T? entity) where T : class
157155
{
158-
if (entity == null)
159-
return null;
160-
161-
// Pokud je to proxy objekt
162-
if (entity is INHibernateProxy proxy)
156+
return entity switch
163157
{
164-
return (T)proxy.HibernateLazyInitializer.GetImplementation();
165-
}
166-
167-
return entity;
158+
null => null,
159+
INHibernateProxy proxy => (T)proxy.HibernateLazyInitializer.GetImplementation(),
160+
_ => entity
161+
};
168162
}
169163
}

FastCloner/FastCloner.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
</PropertyGroup>
2323

2424
<PropertyGroup>
25-
<Version>3.1.6</Version>
25+
<Version>3.1.7</Version>
2626

2727
<Title>FastCloner</Title>
2828
<Description>Fast deep cloning library for .NET 8+. Supports both deep and shallow cloning. Extensively tested, focused on performance and stability even on complicated object graphs.</Description>

0 commit comments

Comments
 (0)