PageRenderTime 16ms CodeModel.GetById 2ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/code/NorthWind/Templates/ImplGen.cst

https://bitbucket.org/eglimi/storm
Unknown | 736 lines | 699 code | 37 blank | 0 comment | 0 complexity | 1373e18925349bdb1dfb37c5c0d9b34c MD5 | raw file
  1<%@ CodeTemplate Language="C#" TargetLanguage="C#" %>
  2<%@ Property Name="assemblyLoader" Type="Storm.Loader.AssemblyLoader" %>
  3<%@ Assembly Name="Storm" %>
  4<%@ Import Namespace="System.Reflection" %>
  5<%@ Import Namespace="System.Collections" %>
  6<%@ Import Namespace="System.Text" %>
  7<%@ Import Namespace="Storm.Attributes" %>
  8<%@ Import Namespace="Storm.Lib" %>
  9
 10
 11<%
 12	initType();
 13	processProperties();
 14	processPrimaryKeys();
 15%>
 16
 17	[DomainObjectImpl]
 18	public class <%= m_type.Name %>Impl : <%= m_type.Name %>
 19	{
 20#region Factory Implementation
 21		<%if(Factory != null){ %>
 22		public class FactoryImpl : <%= m_factory.Name %>, IFactory
 23		{ <%
 24			foreach(MethodInfo mInfo in Factory.GetMethods(BindingFlags.DeclaredOnly|BindingFlags.Instance|BindingFlags.Public))
 25			{
 26				StringBuilder paramFullString = new StringBuilder();
 27				StringBuilder paramString = new StringBuilder();
 28				bool notFirst = false;
 29				foreach(ParameterInfo pInfo in mInfo.GetParameters())
 30				{
 31					if(notFirst)
 32					{
 33						paramFullString.Append(", ");
 34						paramString.Append(", ");
 35					}
 36					paramFullString.Append(pInfo.ParameterType.Name);
 37					paramFullString.Append(" ");
 38					paramFullString.Append(pInfo.Name);
 39					paramString.Append(pInfo.Name);
 40					notFirst = true;
 41				}%>
 42			public override <%= m_type.Name %> <%= mInfo.Name %>(<%= paramFullString.ToString() %>)
 43			{
 44				return new <%= m_type.Name %>Impl(<%= paramString.ToString() %>);
 45			}
 46			<%}
 47		} 
 48		else
 49		{ %>
 50			public class FactoryImpl : IFactory
 51			{
 52		<%} %>
 53			
 54			public DomainObject create()
 55			{
 56				return new <%= m_type.Name %>Impl();
 57			}
 58			
 59			public DomainObject createFromParameters(
 60				Key id,
 61				Timestamp timestamp,
 62				params DictionaryEntry[] parameters)
 63			{
 64				return new <%= m_type.Name %>Impl(id, timestamp, parameters);
 65			}
 66		}
 67#endregion
 68
 69#region Finder Implementation
 70		<%if(Finder != null){ %>
 71		public class FinderImpl : <%= m_finder.Name %>, IFinder
 72		{
 73		<%
 74		foreach(MethodInfo mInfo in Finder.GetMethods(BindingFlags.DeclaredOnly|BindingFlags.Instance|BindingFlags.Public))
 75		{
 76			if(mInfo.IsAbstract) {
 77				StringBuilder paramFullString = new StringBuilder();
 78				StringBuilder paramString = new StringBuilder();
 79				Hashtable paramEntries = new Hashtable();
 80				bool notFirst = false;
 81				foreach(ParameterInfo pInfo in mInfo.GetParameters())
 82				{
 83					if(notFirst)
 84					{
 85						paramFullString.Append(", ");
 86						paramString.Append(", ");
 87					}
 88					paramFullString.Append(pInfo.ParameterType.Name);
 89					paramFullString.Append(" ");
 90					paramFullString.Append(pInfo.Name);
 91					paramString.Append(pInfo.Name);
 92					foreach(Attribute paramAttr in pInfo.GetCustomAttributes(true))
 93					{
 94						if(paramAttr is Storm.Attributes.ParameterDefAttribute)
 95						{
 96							PropertyInfo colPInfo = m_type.GetProperty(((Storm.Attributes.ParameterDefAttribute)paramAttr).PropertyName);
 97							paramEntries.Add(getColumnName(colPInfo), pInfo.Name);
 98						}
 99					} 
100					notFirst = true;
101				}%>
102			public override IList <%= mInfo.Name %>(<%= paramFullString.ToString() %>)
103			{
104				QueryObject qo = new QueryObject();
105				<%
106				foreach(String crit in paramEntries.Keys)
107				{ %>
108				qo.addCriteria(new Criteria(Criteria.Operator.Equal, "<%= crit %>", <%= paramEntries[crit] %>));
109				<% } %>
110
111				return Registry.Instance.getMapper(typeof(<%= m_type.Name %>)).find(qo);
112			}
113			<%}
114		} 
115		} else
116		{ %>
117		public class FinderImpl : IFinder
118		{
119		<%} %>
120			public DomainObject findById(Key id)
121			{
122				return Registry.Instance.getMapper(typeof(<%= m_type.Name %>)).findById(id);
123			}
124			public IList find(QueryObject qo)
125			{
126				return Registry.Instance.getMapper(typeof(<%= m_type.Name %>)).find(qo);
127			}
128			public IList findAll()
129			{
130				return Registry.Instance.getMapper(typeof(<%= m_type.Name %>)).findAll();
131			}
132		}
133#endregion
134
135#region Static Attributes
136		private static FactoryImpl m_FactoryImpl = new FactoryImpl();
137		private static FinderImpl m_FinderImpl = new FinderImpl();
138#endregion
139		
140#region Member Variables
141		<%
142		//Process all Properties and declare the appropriate member variables.
143		//First, all To many relations are resolved then all the rest...
144		foreach(PropertyInfo pInfo in m_properties)
145		{
146			if(!m_primaryKeys.Contains(pInfo.Name) || !isSurrogateKey())
147			{
148				if(isToMany(pInfo)){ %>
149		private ToManyRelation m_<%= pInfo.Name %> = null;
150				<%}
151				if(isToOne(pInfo)){ %>
152		private ToOneRelation m_<%= pInfo.Name %> = null;
153				<%}
154				else if(isColumn(pInfo) && (!isToOne(pInfo))){ %>
155		private object m_<%= pInfo.Name %> = null;
156				<%}
157			}
158		} %>		
159#endregion
160
161#region Constructors
162		public <%= m_type.Name %>Impl()
163		{
164			markNew();
165			<%
166			{
167			foreach(PropertyInfo propInfo in m_properties)
168			{
169				if(isToOne(propInfo))
170				{
171					//if(notFirst)
172					//	paramString.Append(",\n\t\t\t\t\t\t");
173
174					Type relation = null;
175					String fieldName = String.Empty;
176					if(isToOne(propInfo))
177					{
178						foreach(Attribute toOneAttr in propInfo.GetCustomAttributes(true))
179						{
180							if(toOneAttr is Storm.Attributes.ToOneAttribute)
181							{
182								relation = ((Storm.Attributes.ToOneAttribute)toOneAttr).RelationTo;
183								PropertyInfo targetProp = relation.GetProperty(((Storm.Attributes.ToOneAttribute)toOneAttr).RelationName);
184								foreach(Attribute targetAttr in targetProp.GetCustomAttributes(true))
185								{
186									if(targetAttr is Storm.Attributes.ColumnAttribute)
187										fieldName = ((Storm.Attributes.ColumnAttribute)targetAttr).DbColumn;
188								}
189							}
190						}
191						%>
192			m_<%= propInfo.Name %> = new ToOneRelation(typeof(<%= relation.Name %>), "<%= fieldName %>", null);
193					<%
194					}
195					else if(isToMany(propInfo))
196					{
197						foreach(Attribute toManyAttr in propInfo.GetCustomAttributes(true))
198						{
199							if(toManyAttr is Storm.Attributes.ToManyAttribute)
200							{
201								relation = ((Storm.Attributes.ToManyAttribute)toManyAttr).RelationTo;
202								PropertyInfo targetProp = relation.GetProperty(((Storm.Attributes.ToManyAttribute)toManyAttr).RelationName);
203								foreach(Attribute targetAttr in targetProp.GetCustomAttributes(true))
204								{
205									if(targetAttr is Storm.Attributes.ColumnAttribute)
206										fieldName = ((Storm.Attributes.ColumnAttribute)targetAttr).DbColumn;
207								}
208							}
209						}
210						%>
211			m_<%= propInfo.Name %> = new ToOneRelation(typeof(<%= relation.Name %>), "<%= fieldName %>", null, false);
212						<%
213					}
214					//notFirst = true;
215				}
216			} %> 
217			<%} %>
218		}
219		
220		<%
221		if(Factory != null){
222			foreach(MethodInfo mInfo in Factory.GetMethods(BindingFlags.DeclaredOnly|BindingFlags.Instance|BindingFlags.Public))
223			{
224				StringBuilder paramFullString = new StringBuilder();
225				Hashtable paramEntries = new Hashtable();
226				bool notFirst = false;
227				foreach(ParameterInfo pInfo in mInfo.GetParameters())
228				{
229					if(notFirst)
230						paramFullString.Append(", ");
231					paramFullString.Append(pInfo.ParameterType.Name);
232					paramFullString.Append(" ");
233					paramFullString.Append(pInfo.Name);
234					foreach(Attribute paramAttr in pInfo.GetCustomAttributes(true))
235					{
236						if(paramAttr is Storm.Attributes.ParameterDefAttribute)
237						{
238							foreach(PropertyInfo propInfo in m_properties)
239							{
240								if(((Storm.Attributes.ParameterDefAttribute)paramAttr).PropertyName == propInfo.Name)
241								{
242									if(isToOne(propInfo))
243									{
244										paramEntries.Add(((Storm.Attributes.ParameterDefAttribute)paramAttr).PropertyName+".Object", pInfo.Name);
245									}
246									else
247									{
248										paramEntries.Add(((Storm.Attributes.ParameterDefAttribute)paramAttr).PropertyName, pInfo.Name);
249									}
250								}
251							}
252						}
253					} 
254					notFirst = true;
255				} %> 
256		public <%= m_type.Name %>Impl(<%= paramFullString.ToString() %>)
257		{
258			markNew();
259					<%	foreach(PropertyInfo propInfo in m_properties)
260						{ 
261							String fieldName = String.Empty;
262							foreach(Attribute propAttr in propInfo.GetCustomAttributes(true))
263							{									
264								if(propAttr is Storm.Attributes.ToManyAttribute)
265								{	
266									Type targetType = ((Storm.Attributes.ToManyAttribute)propAttr).RelationTo;
267									PropertyInfo targetProp = targetType.GetProperty(((Storm.Attributes.ToManyAttribute)propAttr).RelationName);
268									foreach(Attribute targetAttr in targetProp.GetCustomAttributes(true))
269									{
270										if(targetAttr is Storm.Attributes.ColumnAttribute)
271											fieldName = ((Storm.Attributes.ColumnAttribute)targetAttr).DbColumn;
272									}%>
273			m_<%= propInfo.Name %> = new ToManyRelation(typeof(<%= ((Storm.Attributes.ToManyAttribute)propAttr).RelationTo.Name %>), "<%= fieldName %>", null, true);
274								<%} 
275								else if(propAttr is Storm.Attributes.ToOneAttribute)
276								{ 
277									Type targetType = ((Storm.Attributes.ToOneAttribute)propAttr).RelationTo;
278									PropertyInfo targetProp = targetType.GetProperty(((Storm.Attributes.ToOneAttribute)propAttr).RelationName);
279									foreach(Attribute targetAttr in targetProp.GetCustomAttributes(true))
280									{
281										if(targetAttr is Storm.Attributes.ColumnAttribute)
282											fieldName = ((Storm.Attributes.ColumnAttribute)targetAttr).DbColumn;
283									}%>
284			m_<%= propInfo.Name %> = new ToOneRelation(typeof(<%= ((Storm.Attributes.ToOneAttribute)propAttr).RelationTo.Name %>), "<%= fieldName %>", null);
285								<%} 
286							}
287						}%>
288						<%
289						IDictionaryEnumerator enumerator = paramEntries.GetEnumerator();
290						while(enumerator.MoveNext()){%>
291			m_<%= enumerator.Key %> = <%= enumerator.Value %>;
292						<%} %>
293		}
294			<%} 
295		}%>
296
297		internal <%= m_type.Name %>Impl(
298			Key id, 
299			Timestamp timestamp, 
300			params DictionaryEntry[] parameters)
301		{ 
302			markClean();
303			m_id = id;
304			m_timestamp = timestamp;
305			FieldInfo fInfo;
306			Type thisType = this.GetType();
307			Type domainObjectType = typeof(<%= m_type.Name %>);
308			
309			IEnumerator enumerator = parameters.GetEnumerator();
310
311			while(enumerator.MoveNext())
312			{
313				if(((DictionaryEntry)enumerator.Current).Value != null)
314				{
315					if(((DictionaryEntry)enumerator.Current).Value.GetType() == typeof(ToOneRelation))
316					{ 
317						<%
318						foreach(PropertyInfo propInfo in m_properties)
319						{ 
320							foreach(Attribute propAttr in propInfo.GetCustomAttributes(true))
321							{
322								if(propAttr is Storm.Attributes.ToOneAttribute)
323								{ %>
324						if((String)((DictionaryEntry)enumerator.Current).Key == "<%= propInfo.Name %>")
325						{ 
326							m_<%= propInfo.Name %> = (ToOneRelation)((DictionaryEntry)enumerator.Current).Value;
327							continue;
328						}
329							<%} 
330							}
331					}%>
332					} 
333					if(((DictionaryEntry)enumerator.Current).Value.GetType() == typeof(ToManyRelation))
334					{ 
335						<%
336						foreach(PropertyInfo propInfo in m_properties)
337						{ 
338							foreach(Attribute propAttr in propInfo.GetCustomAttributes(true))
339							{
340								if(propAttr is Storm.Attributes.ToManyAttribute)
341								{ %>
342						if((String)((DictionaryEntry)enumerator.Current).Key == "<%= propInfo.Name %>")
343						{ 
344							m_<%= propInfo.Name %> = (ToManyRelation)((DictionaryEntry)enumerator.Current).Value;
345							continue;
346						}
347							<%	} 
348							}
349						}%>
350					}
351				} 
352				if(this.GetType().GetProperty((String)((DictionaryEntry)enumerator.Current).Key) != null)
353				{
354					string variable = "m_" + (String)((DictionaryEntry)enumerator.Current).Key;
355					if((fInfo = thisType.GetField(variable, BindingFlags.DeclaredOnly|BindingFlags.Public|BindingFlags.NonPublic|BindingFlags.Instance)) != null)
356					{
357							fInfo.SetValue(this, ((DictionaryEntry)enumerator.Current).Value);
358					}
359				}
360			}
361		}
362#endregion
363
364#region Methods
365		<%
366		foreach(MethodInfo mInfo in m_type.GetMethods(BindingFlags.DeclaredOnly|BindingFlags.Instance|BindingFlags.Public))
367		{
368			if(mInfo.IsAbstract)
369			{
370				foreach(Attribute mAttr in mInfo.GetCustomAttributes(true))
371				{
372					if(mAttr is Storm.Attributes.AdderAttribute)
373					{
374						ParameterInfo[] parameters = mInfo.GetParameters();
375						if(parameters.Length != 1)
376						{
377							throw new ApplicationException("Parameter Length not 1: Parameter Length of an Adder Method must be 1");
378						}
379						String returnType = mInfo.ReturnType.Name;
380						if(returnType == "Void")
381							returnType = returnType.ToLower();
382						foreach(ParameterInfo paramInfo in parameters)
383						{ %>
384		public override <%= returnType %> <%= mInfo.Name %>(<%= paramInfo.ParameterType.Name %> <%= paramInfo.Name %>)
385		{
386			if(<%= paramInfo.Name %> != null)
387			{
388				<%= paramInfo.Name %>.<%= ((Storm.Attributes.AdderAttribute)mAttr).TargetProperty %> = this;
389				m_<%= ((Storm.Attributes.AdderAttribute)mAttr).LocalProperty %>.Add(<%= paramInfo.Name %>);
390				this.markDirty();
391			}
392			else
393			{
394				throw new ApplicationException();
395			}
396		}
397						<%}
398					}
399				}
400			}	
401		} 
402		%>
403		
404		public override void delete()
405		{
406			<%
407			foreach(PropertyInfo propInfo in m_properties)
408			{ 
409				foreach(Attribute propAttr in propInfo.GetCustomAttributes(true))
410				{
411					if(propAttr is Storm.Attributes.ToManyAttribute)
412					{ %>
413			foreach(<%= ((Storm.Attributes.ToManyAttribute)propAttr).RelationTo.Name %> <%= ((Storm.Attributes.ToManyAttribute)propAttr).RelationTo.Name.ToLower() %> in <%= propInfo.Name %>)
414			{
415				<%= ((Storm.Attributes.ToManyAttribute)propAttr).RelationTo.Name.ToLower() %>.delete();
416			}
417				<%	} 
418				}
419			}%>
420			
421			this.markRemoved();
422		}
423#endregion
424
425#region Properties
426		<%	
427		//Process all public and non-public properties and write them out.
428		foreach(PropertyInfo pInfo in m_type.GetProperties(BindingFlags.NonPublic|BindingFlags.Public|BindingFlags.Instance))
429		{ 
430			if(hasAttributes(pInfo))
431			{ 
432				if(pInfo.PropertyType.IsPublic){ %>
433		public override <%= pInfo.PropertyType.Name %> <%= pInfo.Name %> 
434				<%} else{ %>
435		protected override <%= pInfo.PropertyType.Name %> <%= pInfo.Name %>
436				<%} %>
437		{
438				<%if(hasGetMethod(pInfo)){ %>
439			get
440			{
441					<%if(!isToMany(pInfo) && !isToOne(pInfo) && (!m_primaryKeys.Contains(pInfo.Name)))
442					{ %>
443				if(m_<%= pInfo.Name %> == null)
444						<%
445						switch(pInfo.PropertyType.Name)
446						{
447							case "Int32" : %>
448					return 0;			
449								<%break;
450							case "Double" : %>
451					return 0.0;			
452								<%break;
453							case "String" : %>
454					return String.Empty;			
455								<%break;
456							case "DateTime" : %>
457					return new DateTime(0);			
458								<%break;
459							default : %>
460					throw new NullReferenceException();
461								<%break;
462						}
463					}
464					if(m_primaryKeys.Contains(pInfo.Name) && !isToOne(pInfo)){%>
465				if(m_id == null)
466						<%
467						switch(pInfo.PropertyType.Name)
468						{
469							case "Int32" : %>
470					return 0;			
471								<%break;
472							case "Double" : %>
473					return 0.0;			
474								<%break;
475							case "String" : %>
476					return String.Empty;			
477								<%break;
478							case "DateTime" : %>
479					return new DateTime(0);			
480								<%break;
481							default : %>
482					throw new NullReferenceException();
483								<%break;
484						} %>
485				return (<%= pInfo.PropertyType.Name %>)m_id[<%= m_primaryKeys.IndexOf(pInfo.Name) %>];
486					<%}
487					else if(isToOne(pInfo)) { %>
488				return (<%= pInfo.PropertyType.Name %>)m_<%= pInfo.Name %>.Object;
489					<%}
490					else { %>
491				return (<%= pInfo.PropertyType.Name %>)m_<%= pInfo.Name %>;
492					<%} %>
493			}
494				<%} %>
495				<%if(hasSetMethod(pInfo)){ %>
496			set
497			{
498					<%if(isToOne(pInfo)) { %>
499				m_<%= pInfo.Name %>.Object = value;
500					<%}
501					else { 
502						if(m_primaryKeys.Contains(pInfo.Name))
503						{
504					%>
505				if(m_id == null)
506					m_id = new Key(new object[] {value});
507				else
508					m_id[<%= m_primaryKeys.IndexOf(pInfo.Name) %>] = value;
509					<%
510						}
511					%>
512				m_<%= pInfo.Name %> = value;
513				markDirty();
514					<%
515					} %>
516			}
517				<%
518				} %>
519		}
520			<%
521			} 
522		} %>
523				
524		public static FactoryImpl Factory
525		{
526			get
527			{
528				return m_FactoryImpl;
529			}
530		}
531		
532		public static FinderImpl Finder
533		{
534			get
535			{
536				return m_FinderImpl;
537			}
538		}
539		
540		public override bool isNull(string propertyName)
541		{
542			switch(propertyName)
543			{
544			<%
545				foreach(PropertyInfo pInfo in m_type.GetProperties(BindingFlags.NonPublic|BindingFlags.Public|BindingFlags.Instance))
546				{ 
547					if(hasAttributes(pInfo))
548					{
549						if(!isToMany(pInfo) && !isToOne(pInfo) && !m_primaryKeys.Contains(pInfo.Name))
550						{
551			%>
552				case "<%= pInfo.Name %>":
553					if(m_<%= pInfo.Name %> == null) return true;
554					break;
555			<%
556						}
557						else if(isToOne(pInfo))
558						{
559			%>
560				case "<%= pInfo.Name %>":
561					if(m_<%= pInfo.Name %>.Object == null) return true;
562					break;
563			<%
564						}
565					}
566				}
567			%>
568				default:
569					break;
570			}
571			return false;
572		}
573#endregion
574	}
575
576<script runat="template">
577	private Type m_type = null;
578	private ArrayList m_properties = null;
579	private ArrayList m_primaryKeys = null;
580	private Type m_factory = null;
581	private Type m_finder = null;
582	
583	void initType()
584	{
585		m_type = assemblyLoader.ClassType;
586	}
587	
588	bool hasAttributes(PropertyInfo pInfo)
589	{
590		return pInfo.GetCustomAttributes(true).Length > 0 ? true : false;
591	}
592	
593	bool hasGetMethod(PropertyInfo pInfo)
594	{
595		return pInfo.GetGetMethod(true) is MethodInfo ? true : false;
596	}
597	
598	bool hasSetMethod(PropertyInfo pInfo)
599	{
600		return pInfo.GetSetMethod(true) is MethodInfo ? true : false;
601	}
602
603	string getColumnName(PropertyInfo propInfo)
604	{
605		String columnName = String.Empty;
606		foreach(Attribute propAttr in propInfo.GetCustomAttributes(true))
607		{
608			if(propAttr is Storm.Attributes.ColumnAttribute)
609				columnName = ((Storm.Attributes.ColumnAttribute)propAttr).DbColumn;
610		}
611		return columnName;
612	}
613	
614	bool isToMany(PropertyInfo pInfo)
615	{
616		foreach(Attribute attr in pInfo.GetCustomAttributes(true))
617		{
618			if(attr is Storm.Attributes.ToManyAttribute)
619				return true;
620		}
621		return false;
622	}
623
624	bool isToOne(PropertyInfo pInfo)
625	{
626		foreach(Attribute attr in pInfo.GetCustomAttributes(true))
627		{
628			if(attr is Storm.Attributes.ToOneAttribute)
629				return true;
630		}
631		return false;
632	}
633	
634	bool isColumn(PropertyInfo pInfo)
635	{
636		foreach(Attribute attr in pInfo.GetCustomAttributes(true))
637		{
638			if(attr is Storm.Attributes.ColumnAttribute)
639				return true;
640		}
641		return false;
642	}
643	
644	bool isPrimaryKey(PropertyInfo pInfo)
645	{
646		foreach(Attribute attr in pInfo.GetCustomAttributes(true))
647		{
648			if(attr is Storm.Attributes.PrimaryKeyAttribute)
649				return true;
650		}
651		return false;
652	}
653	
654	bool isSurrogateKey()
655	{
656		foreach(Attribute attr in m_type.GetCustomAttributes(false))
657			if(attr is Storm.Attributes.TableAttribute)
658				return ((Storm.Attributes.TableAttribute)attr).KeyIsSurrogate ? true : false;
659		return false;
660	}
661	
662	void processProperties()
663	{
664		if(m_properties == null)
665			m_properties = new ArrayList();
666		foreach(PropertyInfo pInfo in m_type.GetProperties(BindingFlags.Public|BindingFlags.NonPublic|BindingFlags.Instance))
667		{
668			m_properties.Add(pInfo);
669		}
670	}
671	
672	void processPrimaryKeys()
673	{
674		if(m_primaryKeys == null)
675			m_primaryKeys = new ArrayList();
676		foreach(PropertyInfo pInfo in m_type.GetProperties(BindingFlags.Public|BindingFlags.NonPublic|BindingFlags.Instance))
677		{
678			foreach(Attribute propAttr in pInfo.GetCustomAttributes(true))
679			{
680				if(propAttr is Storm.Attributes.PrimaryKeyAttribute)
681					m_primaryKeys.Add(pInfo.Name);
682			}
683		}
684	}
685	
686	//only one factory is allowed
687	private Type Factory
688	{
689		get
690		{
691			if(m_factory == null)
692			{
693				foreach(Type nType in m_type.GetNestedTypes())
694				{
695					if(nType.IsClass && nType.IsAbstract)
696					{
697						foreach(Attribute attr in nType.GetCustomAttributes(true))
698						{
699							if(attr is Storm.Attributes.FactoryAttribute)
700							{
701								m_factory = nType;
702								return m_factory;
703							}
704						}
705					}
706				}
707			}
708			return m_factory;
709		}
710	}
711
712	private Type Finder
713	{
714		get
715		{
716			if(m_finder == null)
717			{
718				foreach(Type nType in m_type.GetNestedTypes())
719				{
720					if(nType.IsClass && nType.IsAbstract)
721					{
722						foreach(Attribute attr in nType.GetCustomAttributes(true))
723						{
724							if(attr is Storm.Attributes.FinderAttribute)
725							{
726								m_finder = nType;
727								return m_finder;
728							}
729						}
730					}
731				}
732			}
733			return m_finder;
734		}
735	}
736</script>