Skip to content

Commit

Permalink
up version
Browse files Browse the repository at this point in the history
  • Loading branch information
lofcz committed Jan 8, 2025
1 parent 8897ea1 commit ff2039e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
26 changes: 10 additions & 16 deletions FastCloner.Tests/DbTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,14 @@ public class DbTests
[OneTimeSetUp]
public void SetUp()
{
// Smažeme existující databázi, pokud existuje
if (File.Exists(DbFile))
{
File.Delete(DbFile);
}

Configuration configuration = CreateConfiguration();
sessionFactory = configuration.BuildSessionFactory();

// Vytvoříme schéma databáze

using (ISession? session = sessionFactory.OpenSession())
{
SchemaExport export = new SchemaExport(configuration);
Expand All @@ -42,7 +40,7 @@ public void SetUp()
[OneTimeTearDown]
public void TearDown()
{
sessionFactory?.Dispose();
sessionFactory.Dispose();

if (File.Exists(DbFile))
{
Expand Down Expand Up @@ -80,7 +78,7 @@ public class EntityMap : ClassMap<Entity>
{
public EntityMap()
{
Table("Entities"); // Změněno z "Entity"
Table("Entities");
Id(x => x.Id).GeneratedBy.Identity();
Map(x => x.Name);
HasMany(x => x.Children)
Expand All @@ -94,7 +92,7 @@ public class ChildEntityMap : ClassMap<ChildEntity>
{
public ChildEntityMap()
{
Table("ChildEntities"); // Změněno z "ChildEntity"
Table("ChildEntities");
Id(x => x.Id).GeneratedBy.Identity();
Map(x => x.Name);
References(x => x.Entity)
Expand Down Expand Up @@ -153,17 +151,13 @@ public void Test_CloneNHibernateProxy()

public static class NHibernateHelper
{
public static T Unproxy<T>(T entity) where T : class
public static T? Unproxy<T>(T? entity) where T : class
{
if (entity == null)
return null;

// Pokud je to proxy objekt
if (entity is INHibernateProxy proxy)
return entity switch
{
return (T)proxy.HibernateLazyInitializer.GetImplementation();
}

return entity;
null => null,
INHibernateProxy proxy => (T)proxy.HibernateLazyInitializer.GetImplementation(),
_ => entity
};
}
}
2 changes: 1 addition & 1 deletion FastCloner/FastCloner.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</PropertyGroup>

<PropertyGroup>
<Version>3.1.6</Version>
<Version>3.1.7</Version>

<Title>FastCloner</Title>
<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>
Expand Down

0 comments on commit ff2039e

Please sign in to comment.