Skip to content

Commit df7fb3a

Browse files
Merge pull request #1709 from fredericDelaporte/LazyPropertiesStaticProxy
Implement a lazy properties static proxy
2 parents 55c79b7 + 5d77746 commit df7fb3a

File tree

55 files changed

+1213
-397
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1213
-397
lines changed

src/AsyncGenerator.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@
196196
name: LinqReadonlyTestsContext
197197
- conversion: Ignore
198198
name: MultiThreadRunner
199+
- conversion: Ignore
200+
name: PeVerifier
199201
- conversion: Ignore
200202
hasAttributeName: IgnoreAttribute
201203
- conversion: NewType

src/NHibernate.Test/Async/DynamicEntity/Interceptor/InterceptorDynamicEntity.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
//------------------------------------------------------------------------------
99

1010

11+
using System;
1112
using System.Collections;
1213
using NHibernate.Cfg;
1314
using NUnit.Framework;
@@ -16,6 +17,7 @@ namespace NHibernate.Test.DynamicEntity.Interceptor
1617
{
1718
using System.Threading.Tasks;
1819
[TestFixture]
20+
[Obsolete("Require dynamic proxies")]
1921
public class InterceptorDynamicEntityAsync : TestCase
2022
{
2123
protected override string MappingsAssembly
@@ -100,4 +102,4 @@ public async Task ItAsync()
100102
session.Close();
101103
}
102104
}
103-
}
105+
}

src/NHibernate.Test/Async/DynamicEntity/Tuplizer/TuplizerDynamicEntity.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
//------------------------------------------------------------------------------
99

1010

11+
using System;
1112
using System.Collections;
1213
using System.Collections.Generic;
1314
using NHibernate.Cfg;
@@ -17,6 +18,7 @@ namespace NHibernate.Test.DynamicEntity.Tuplizer
1718
{
1819
using System.Threading.Tasks;
1920
[TestFixture]
21+
[Obsolete("Require dynamic proxies")]
2022
public class TuplizerDynamicEntityAsync : TestCase
2123
{
2224
protected override string MappingsAssembly
@@ -116,4 +118,4 @@ public async Task ItAsync()
116118
session.Close();
117119
}
118120
}
119-
}
121+
}

src/NHibernate.Test/Async/DynamicProxyTests/PeVerifier.cs

Lines changed: 0 additions & 46 deletions
This file was deleted.

src/NHibernate.Test/Async/DynamicProxyTests/PeVerifyFixture.cs

Lines changed: 0 additions & 133 deletions
This file was deleted.

src/NHibernate.Test/CfgTest/Loquacious/ConfigurationFixture.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
using NHibernate.Driver;
1010
using NHibernate.Exceptions;
1111
using NHibernate.Hql.Ast.ANTLR;
12-
using NHibernate.Linq;
1312
using NHibernate.Type;
1413
using NUnit.Framework;
1514

@@ -37,7 +36,7 @@ public void CompleteConfiguration()
3736
.Through<DefaultCollectionTypeFactory>()
3837
.Proxy
3938
.DisableValidation()
40-
.Through<DefaultProxyFactoryFactory>()
39+
.Through<StaticProxyFactoryFactory>()
4140
.ParsingHqlThrough<ASTQueryTranslatorFactory>()
4241
.Mapping
4342
.UsingDefaultCatalog("MyCatalog")
@@ -75,7 +74,7 @@ public void CompleteConfiguration()
7574
Assert.That(cfg.Properties[Environment.CacheDefaultExpiration], Is.EqualTo("15"));
7675
Assert.That(cfg.Properties[Environment.CollectionTypeFactoryClass], Is.EqualTo(typeof(DefaultCollectionTypeFactory).AssemblyQualifiedName));
7776
Assert.That(cfg.Properties[Environment.UseProxyValidator], Is.EqualTo("false"));
78-
Assert.That(cfg.Properties[Environment.ProxyFactoryFactoryClass], Is.EqualTo(typeof(DefaultProxyFactoryFactory).AssemblyQualifiedName));
77+
Assert.That(cfg.Properties[Environment.ProxyFactoryFactoryClass], Is.EqualTo(typeof(StaticProxyFactoryFactory).AssemblyQualifiedName));
7978
Assert.That(cfg.Properties[Environment.QueryTranslator], Is.EqualTo(typeof(ASTQueryTranslatorFactory).AssemblyQualifiedName));
8079
Assert.That(cfg.Properties[Environment.DefaultCatalog], Is.EqualTo("MyCatalog"));
8180
Assert.That(cfg.Properties[Environment.DefaultSchema], Is.EqualTo("MySche"));
@@ -108,13 +107,13 @@ public void UseDbConfigurationStringBuilder()
108107
// The place where put default properties values is the Dialect itself.
109108
var cfg = new Configuration();
110109
cfg.SessionFactory()
111-
.Proxy.Through<DefaultProxyFactoryFactory>()
110+
.Proxy.Through<StaticProxyFactoryFactory>()
112111
.Integrate
113112
.Using<MsSql2005Dialect>()
114113
.Connected
115114
.Using(new SqlConnectionStringBuilder { DataSource = "(local)", InitialCatalog = "nhibernate", IntegratedSecurity = true });
116115

117-
Assert.That(cfg.Properties[Environment.ProxyFactoryFactoryClass], Is.EqualTo(typeof(DefaultProxyFactoryFactory).AssemblyQualifiedName));
116+
Assert.That(cfg.Properties[Environment.ProxyFactoryFactoryClass], Is.EqualTo(typeof(StaticProxyFactoryFactory).AssemblyQualifiedName));
118117
Assert.That(cfg.Properties[Environment.Dialect], Is.EqualTo(typeof(MsSql2005Dialect).AssemblyQualifiedName));
119118
Assert.That(cfg.Properties[Environment.ConnectionString], Is.EqualTo("Data Source=(local);Initial Catalog=nhibernate;Integrated Security=True"));
120119
}

src/NHibernate.Test/CfgTest/Loquacious/LambdaConfigurationFixture.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public void FullConfiguration()
3535
configure.Proxy(p =>
3636
{
3737
p.Validation = false;
38-
p.ProxyFactoryFactory<DefaultProxyFactoryFactory>();
38+
p.ProxyFactoryFactory<StaticProxyFactoryFactory>();
3939
});
4040
configure.Mappings(m=>
4141
{
@@ -76,7 +76,7 @@ public void FullConfiguration()
7676
Is.EqualTo(typeof(DefaultCollectionTypeFactory).AssemblyQualifiedName));
7777
Assert.That(configure.Properties[Environment.UseProxyValidator], Is.EqualTo("false"));
7878
Assert.That(configure.Properties[Environment.ProxyFactoryFactoryClass],
79-
Is.EqualTo(typeof(DefaultProxyFactoryFactory).AssemblyQualifiedName));
79+
Is.EqualTo(typeof(StaticProxyFactoryFactory).AssemblyQualifiedName));
8080
Assert.That(configure.Properties[Environment.QueryTranslator],
8181
Is.EqualTo(typeof(ASTQueryTranslatorFactory).AssemblyQualifiedName));
8282
Assert.That(configure.Properties[Environment.DefaultCatalog], Is.EqualTo("MyCatalog"));

src/NHibernate.Test/DynamicEntity/DataProxyHandler.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
using System;
12
using System.Collections;
23
using NHibernate.Proxy.DynamicProxy;
34

45
namespace NHibernate.Test.DynamicEntity
56
{
7+
[Obsolete("Require dynamic proxies")]
68
public sealed class DataProxyHandler : Proxy.DynamicProxy.IInterceptor
79
{
810
private readonly Hashtable data = new Hashtable();
@@ -56,4 +58,4 @@ public object Intercept(InvocationInfo info)
5658

5759
#endregion
5860
}
59-
}
61+
}
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
using System;
2+
13
namespace NHibernate.Test.DynamicEntity
24
{
5+
[Obsolete("Require dynamic proxies")]
36
public interface IProxyMarker
47
{
58
DataProxyHandler DataHandler { get;}
69
}
7-
}
10+
}

src/NHibernate.Test/DynamicEntity/Interceptor/InterceptorDynamicEntity.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
using System;
12
using System.Collections;
23
using NHibernate.Cfg;
34
using NUnit.Framework;
45

56
namespace NHibernate.Test.DynamicEntity.Interceptor
67
{
78
[TestFixture]
9+
[Obsolete("Require dynamic proxies")]
810
public class InterceptorDynamicEntity : TestCase
911
{
1012
protected override string MappingsAssembly
@@ -89,4 +91,4 @@ public void It()
8991
session.Close();
9092
}
9193
}
92-
}
94+
}

src/NHibernate.Test/DynamicEntity/Interceptor/ProxyInterceptor.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
using System;
2+
13
namespace NHibernate.Test.DynamicEntity.Interceptor
24
{
5+
[Obsolete("Require dynamic proxies")]
36
public class ProxyInterceptor : EmptyInterceptor
47
{
58
public override string GetEntityName(object entity)
@@ -21,4 +24,4 @@ public override object Instantiate(string entityName, object id)
2124
return base.Instantiate(entityName, id);
2225
}
2326
}
24-
}
27+
}

src/NHibernate.Test/DynamicEntity/ProxyHelper.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
using System;
12
using NHibernate.Proxy.DynamicProxy;
23

34
namespace NHibernate.Test.DynamicEntity
45
{
6+
[Obsolete("Require dynamic proxies")]
57
public class ProxyHelper
68
{
79
private static readonly ProxyFactory proxyGenerator = new ProxyFactory();
@@ -67,4 +69,4 @@ public static string ExtractEntityName(object obj)
6769
return null;
6870
}
6971
}
70-
}
72+
}
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
using System;
2+
13
namespace NHibernate.Test.DynamicEntity.Tuplizer
24
{
5+
[Obsolete("Require dynamic proxies")]
36
public class EntityNameInterceptor : EmptyInterceptor
47
{
58
public override string GetEntityName(object entity)
@@ -8,4 +11,4 @@ public override string GetEntityName(object entity)
811
return entityName;
912
}
1013
}
11-
}
14+
}

0 commit comments

Comments
 (0)