Example #1
0
 /// <summary>
 /// Instantiate an instance of the object described by the supplied
 /// <paramref name="definition"/> from the supplied <paramref name="factory"/>.
 /// </summary>
 /// <param name="definition">
 /// The definition of the object that is to be instantiated.
 /// </param>
 /// <param name="name">
 /// The name associated with the object definition. The name can be the null
 /// or zero length string if we're autowiring an object that doesn't belong
 /// to the supplied <paramref name="factory"/>.
 /// </param>
 /// <param name="factory">
 /// The owning <see cref="Spring.Objects.Factory.IObjectFactory"/>
 /// </param>
 /// <returns>
 /// An instance of the object described by the supplied
 /// <paramref name="definition"/> from the supplied <paramref name="factory"/>.
 /// </returns>
 public override object Instantiate(
     RootObjectDefinition definition, string name, IObjectFactory factory)
 {
     if (definition is IWebObjectDefinition && ((IWebObjectDefinition)definition).IsPage)
     {
         return(WebObjectUtils.CreatePageInstance(((IWebObjectDefinition)definition).PageName));
     }
     else
     {
         return(base.Instantiate(definition, name, factory));
     }
 }
 public void CreatePageInstanceWhenNotRunningInServerContext()
 {
     WebObjectUtils.CreatePageInstance("foo.aspx");
 }
 public void CreatePageInstanceWhenNotRunningInServerContext()
 {
     Assert.Throws <ObjectCreationException>(() => WebObjectUtils.CreatePageInstance("foo.aspx"));
 }