Mercurial > pub > bltoolkit
comparison Source/Mapping/ObjectMapperAttribute.cs @ 0:f990fcb411a9
Копия текущей версии из github
author | cin |
---|---|
date | Thu, 27 Mar 2014 21:46:09 +0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f990fcb411a9 |
---|---|
1 using System; | |
2 | |
3 namespace BLToolkit.Mapping | |
4 { | |
5 [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)] | |
6 public sealed class ObjectMapperAttribute : Attribute | |
7 { | |
8 public ObjectMapperAttribute(Type objectMapperType) | |
9 { | |
10 if (objectMapperType == null) throw new ArgumentNullException("objectMapperType"); | |
11 | |
12 _objectMapper = Activator.CreateInstance(objectMapperType) as ObjectMapper; | |
13 | |
14 if (_objectMapper == null) | |
15 throw new ArgumentException( | |
16 string.Format("Type '{0}' does not implement IObjectMapper interface.", objectMapperType)); | |
17 } | |
18 | |
19 private readonly ObjectMapper _objectMapper; | |
20 public ObjectMapper ObjectMapper | |
21 { | |
22 get { return _objectMapper; } | |
23 } | |
24 } | |
25 } |