Changeset 3037 for trunk/sources
- Timestamp:
- 03/15/10 14:46:30 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Persistence/3.3/Core/ConfigurationService.cs
r3030 r3037 168 168 try { 169 169 foreach (Type t in a.GetTypes()) { 170 if (t.GetInterface(typeof(IPrimitiveSerializer).FullName) != null) { 171 try { 172 IPrimitiveSerializer primitiveSerializer = 173 (IPrimitiveSerializer)Activator.CreateInstance(t, true); 174 if (!PrimitiveSerializers.ContainsKey(primitiveSerializer.SerialDataType)) { 175 PrimitiveSerializers.Add(primitiveSerializer.SerialDataType, new List<IPrimitiveSerializer>()); 176 } 177 PrimitiveSerializers[primitiveSerializer.SerialDataType].Add(primitiveSerializer); 178 Logger.Debug(String.Format("discovered primitive serializer {0} ({1} -> {2})", 179 t.VersionInvariantName(), 180 primitiveSerializer.SourceType.AssemblyQualifiedName, 181 primitiveSerializer.SerialDataType.AssemblyQualifiedName)); 182 } catch (MissingMethodException e) { 183 Logger.Warn("Could not instantiate " + t.AssemblyQualifiedName, e); 184 } catch (ArgumentException e) { 185 Logger.Warn("Could not instantiate " + t.AssemblyQualifiedName, e); 186 } 170 if (t.GetInterface(typeof(IPrimitiveSerializer).FullName) != null && 171 !t.IsAbstract && t.GetConstructor(Type.EmptyTypes) != null && !t.ContainsGenericParameters) { 172 IPrimitiveSerializer primitiveSerializer = 173 (IPrimitiveSerializer)Activator.CreateInstance(t, true); 174 if (!PrimitiveSerializers.ContainsKey(primitiveSerializer.SerialDataType)) 175 PrimitiveSerializers.Add(primitiveSerializer.SerialDataType, new List<IPrimitiveSerializer>()); 176 PrimitiveSerializers[primitiveSerializer.SerialDataType].Add(primitiveSerializer); 177 Logger.Debug(String.Format("discovered primitive serializer {0} ({1} -> {2})", 178 t.VersionInvariantName(), 179 primitiveSerializer.SourceType.AssemblyQualifiedName, 180 primitiveSerializer.SerialDataType.AssemblyQualifiedName)); 187 181 } 188 if (t.GetInterface(typeof(ICompositeSerializer).FullName) != null) { 189 try { 190 CompositeSerializers.Add((ICompositeSerializer)Activator.CreateInstance(t, true)); 191 Logger.Debug("discovered composite serializer " + t.AssemblyQualifiedName); 192 } catch (MissingMethodException e) { 193 Logger.Warn("Could not instantiate " + t.AssemblyQualifiedName, e); 194 } catch (ArgumentException e) { 195 Logger.Warn("Could not instantiate " + t.AssemblyQualifiedName, e); 196 } 182 if (t.GetInterface(typeof(ICompositeSerializer).FullName) != null && 183 !t.IsAbstract && t.GetConstructor(Type.EmptyTypes) != null && !t.ContainsGenericParameters) { 184 CompositeSerializers.Add((ICompositeSerializer)Activator.CreateInstance(t, true)); 185 Logger.Debug("discovered composite serializer " + t.AssemblyQualifiedName); 197 186 } 198 if (t.GetInterface(typeof(IFormat).FullName) != null) { 199 try { 200 IFormat format = (IFormat)Activator.CreateInstance(t, true); 201 Formats.Add(format); 202 Logger.Debug(String.Format("discovered format {0} ({2}) with serial data {1}.", 203 format.Name, 204 format.SerialDataType, 205 t.AssemblyQualifiedName)); 206 } catch (MissingMethodException e) { 207 Logger.Warn("Could not instantiate " + t.AssemblyQualifiedName, e); 208 } catch (ArgumentException e) { 209 Logger.Warn("Could not instantiate " + t.AssemblyQualifiedName, e); 210 } 187 if (t.GetInterface(typeof(IFormat).FullName) != null && 188 !t.IsAbstract && t.GetConstructor(Type.EmptyTypes) != null && !t.ContainsGenericParameters) { 189 IFormat format = (IFormat)Activator.CreateInstance(t, true); 190 Formats.Add(format); 191 Logger.Debug(String.Format("discovered format {0} ({2}) with serial data {1}.", 192 format.Name, 193 format.SerialDataType, 194 t.AssemblyQualifiedName)); 211 195 } 212 196 }
Note: See TracChangeset
for help on using the changeset viewer.