public DynamicItemsRepositoryBase()
 {
     this.manager      = DynamicModuleManager.GetManager(this.ProviderName);
     this.itemType     = TypeResolutionService.ResolveType(this.ItemTypeName);
     this.itemsFactory = this.ResolveItemsFactory();
 }
Ejemplo n.º 2
0
 /// <summary>
 ///     Constructs a new instance of the given type, and return it cast to the specified type.
 /// </summary>
 /// <param name="dynamicTypeFactory">The dynamic type factory to use.</param>
 /// <param name="type">The type to instantiate.</param>
 /// <param name="args">The arguments to pass to the constructor.</param>
 /// <typeparam name="T">The type that the instance will be cast to.</typeparam>
 /// <returns>Newly created object, cast to <typeparamref name="T"/>.</returns>
 public static T CreateInstance <T>(this IDynamicTypeFactory dynamicTypeFactory, Type type, object[] args)
 {
     DebugTools.Assert(typeof(T).IsAssignableFrom(type), "type must be subtype of T");
     return((T)dynamicTypeFactory.CreateInstance(type, args));
 }