Changeset 1332
- Timestamp:
- 03/12/09 14:09:35 (16 years ago)
- Location:
- branches/New Persistence Exploration/Persistence
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/New Persistence Exploration/Persistence/Persistence.sln
r1329 r1332 4 4 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Persistence", "Persistence\Persistence.csproj", "{102BC7D3-0EF9-439C-8F6D-96FF0FDB8E1B}" 5 5 EndProject 6 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2F65B17D-22F7-4A48-8762-74BB8BE3E0E5}"7 ProjectSection(SolutionItems) = preProject8 LocalTestRun.testrunconfig = LocalTestRun.testrunconfig9 Persistence.vsmdi = Persistence.vsmdi10 EndProjectSection11 EndProject12 6 Global 13 GlobalSection(TestCaseManagementSettings) = postSolution14 CategoryFile = Persistence.vsmdi15 EndGlobalSection16 7 GlobalSection(SolutionConfigurationPlatforms) = preSolution 17 8 Debug|Any CPU = Debug|Any CPU -
branches/New Persistence Exploration/Persistence/Persistence/CompoundSerializers.cs
r1323 r1332 28 28 } 29 29 public object DeSerialize(IEnumerable objects, Type t) { 30 object instance = Activator.CreateInstance(t );30 object instance = Activator.CreateInstance(t, true); 31 31 foreach (object o in objects) { 32 32 t.GetMethod("Add").Invoke(instance, new[] { o }); … … 78 78 79 79 public class KeyValuePair2XmlSerializer : ICompoundSerializer { 80 public bool CanSerialize(Type type) { 80 public bool CanSerialize(Type type) { 81 81 return type.IsGenericType && 82 82 type.GetGenericTypeDefinition().Name == "KeyValuePair`2"; … … 87 87 yield return t.GetProperty("Value").GetValue(o, null); 88 88 } 89 public object DeSerialize(IEnumerable o, Type t) { 89 public object DeSerialize(IEnumerable o, Type t) { 90 90 return Activator.CreateInstance(t, 91 91 new List<object>((IEnumerable<object>)o).ToArray()); … … 105 105 } 106 106 public object DeSerialize(IEnumerable o, Type t) { 107 IDictionary dict = (IDictionary)Activator.CreateInstance(t );107 IDictionary dict = (IDictionary)Activator.CreateInstance(t, true); 108 108 IEnumerator iter = o.GetEnumerator(); 109 109 while (iter.MoveNext()) { -
branches/New Persistence Exploration/Persistence/Persistence/DeSerializer.cs
r1331 r1332 1 1 using System.Collections.Generic; 2 2 using System; 3 namespace Persistence { 3 namespace Persistence { 4 4 5 public class DeSerializer { 5 6 … … 102 103 compositeStack.Push(new CustomObject(instance)); 103 104 id2obj.Add(start.Id, instance); 104 } else { 105 instance = Activator.CreateInstance(start.Type );105 } else { 106 instance = Activator.CreateInstance(start.Type, true); 106 107 Dictionary<string, DataMemberAccessor> accessorDict = 107 108 StorableAttribute.GetAutostorableAccessors(instance); -
branches/New Persistence Exploration/Persistence/Persistence/StorableAttribute.cs
r1331 r1332 200 200 } 201 201 object method(object obj, Dictionary<object, object> twins) { 202 object newInstance = Activator.CreateInstance(obj.GetType() );202 object newInstance = Activator.CreateInstance(obj.GetType(), true); 203 203 twins.Add(obj, newInstance); 204 204 foreach (FieldAccessor fa in fieldAccessors) {
Note: See TracChangeset
for help on using the changeset viewer.