コード例 #1
0
        /// <summary>
        /// Create the factory from a fully-qualified type name.
        /// </summary>
        /// <param name="className">The class name for the desired factory instance.</param>
        public IRenderingContextFactory Create(string className)
        {
            IRenderingContextFactory output;
              Type outputType;

              if(String.IsNullOrEmpty(className))
              {
            output = new TalesRenderingContextFactory();
              }
              else if((outputType = Type.GetType(className)) != null
              && typeof(IRenderingContextFactory).IsAssignableFrom(outputType))
              {
            output = (IRenderingContextFactory) Activator.CreateInstance(outputType);
              }
              else
              {
            string message = String.Format(ExceptionMessages.CouldNotInstantiateTypeFormat,
                                       typeof(IRenderingContextFactory).Name,
                                       className);
            throw new CouldNotCreateRenderingContextFactoryException(message) {
              InvalidClassname = className
            };
              }

              return output;
        }
コード例 #2
0
 protected virtual IRenderingContextFactory CreateTestEnvironment(DirectoryInfo rootPath)
 {
     var output = new TalesRenderingContextFactory();
       output.RootDocumentPath = rootPath.FullName;
       return output;
 }