Datei: QueryTests/NDOFactory.cs

Last Commit (10db6e2)
1 using System;
2 using System.IO;
 
3 using NDO;
4 using NDO.Mapping;
5
6 namespace QueryTests
7 {
8 ····class NDOFactory
9 ····{
10 ········static object lockObject = new object();
11 ········static NDOFactory instance;
12 ········static NDOMapping mapping;
13
14 ········static NDOFactory()
15 ········{
16 ············instance = new NDOFactory();
17 ········}
18
19 ········public static NDOFactory Instance
20 ········{
21 ············get { return instance; }
22 ········}
23
24 ········public PersistenceManager PersistenceManager
25 ········{
26 ············get
27 ············{
28 ················PersistenceManager pm;
29 ················lock (lockObject)
30 ················{
31 ····················if (mapping == null)
32 ····················{
33 ························pm = new PersistenceManager();
34 ························mapping = pm.NDOMapping;
35 ····················}
36 ····················else
37 ····················{
38 ························pm = new PersistenceManager( mapping );
39 ····················}
40 ················}
41
 
42 ················return pm;
43 ············}
44 ········}
45 ····}
46 }
47
New Commit (8c50417)
1 using System;
2 using System.IO;
3 using DataTypeTestClasses;
4 using NDO;
5 using NDO.Mapping;
6
7 namespace QueryTests
8 {
9 ····class NDOFactory
10 ····{
11 ········static object lockObject = new object();
12 ········static NDOFactory instance;
13 ········static NDOMapping mapping;
14
15 ········static NDOFactory()
16 ········{
17 ············instance = new NDOFactory();
18 ········}
19
20 ········public static NDOFactory Instance
21 ········{
22 ············get { return instance; }
23 ········}
24
25 ········public PersistenceManager PersistenceManager
26 ········{
27 ············get
28 ············{
29 ················PersistenceManager pm;
30 ················lock (lockObject)
31 ················{
32 ····················if (mapping == null)
33 ····················{
34 ························pm = new PersistenceManager();
35 ························mapping = pm.NDOMapping;
36 ····················}
37 ····················else
38 ····················{
39 ························pm = new PersistenceManager( mapping );
40 ····················}
41 ················}
42 // Setting an AccessorName to avoid changing the full chain of dependencies for PureBusinessClasses
43 ················pm.NDOMapping.FindClass( typeof( DataContainerDerived ) ).FindField( "byteArrVar" ).AccessorName = "ByteArrVar";
44 ················return pm;
45 ············}
46 ········}
47 ····}
48 }
49