Mercurial > pub > ImplabNet
comparison Implab.ServiceHost/Unity/ContainerConfigurationSchema.cs @ 277:963b17c275be v3
Refactoring
Added <array> element to injection parameters
Working on registrations of factories
author | cin |
---|---|
date | Sat, 28 Apr 2018 18:48:09 +0300 |
parents | 22629bf26121 |
children | 6691aff01de1 |
comparison
equal
deleted
inserted
replaced
276:b4e0f81c7425 | 277:963b17c275be |
---|---|
31 | 31 |
32 public void RegisterContainerElement(Type type, string name) { | 32 public void RegisterContainerElement(Type type, string name) { |
33 Safe.ArgumentNotNull(type, nameof(type)); | 33 Safe.ArgumentNotNull(type, nameof(type)); |
34 Safe.ArgumentNotEmpty(name, nameof(name)); | 34 Safe.ArgumentNotEmpty(name, nameof(name)); |
35 | 35 |
36 if(!type.IsSubclassOf(typeof(ContainerItemElement))) | 36 if(!type.IsSubclassOf(typeof(AbstractContainerItem))) |
37 throw new Exception($"RegisterContainerElement '{name}': {type} must be subclass of {typeof(ContainerItemElement)}"); | 37 throw new Exception($"RegisterContainerElement '{name}': {type} must be subclass of {typeof(AbstractContainerItem)}"); |
38 | 38 |
39 m_containerItems.XmlElements.Add( | 39 m_containerItems.XmlElements.Add( |
40 new XmlElementAttribute(name, type) | 40 new XmlElementAttribute(name, type) |
41 ); | 41 ); |
42 } | 42 } |
43 | 43 |
44 public void RegisterContainerElement<T>(string name) where T : ContainerItemElement { | 44 public void RegisterContainerElement<T>(string name) where T : AbstractContainerItem { |
45 RegisterContainerElement(typeof(T), name); | 45 RegisterContainerElement(typeof(T), name); |
46 } | 46 } |
47 | 47 |
48 public ContainerElement LoadFile(string file) { | 48 public ContainerElement LoadFile(string file) { |
49 using (var reader = XmlReader.Create(file)) { | 49 using (var reader = XmlReader.Create(file)) { |