/// <summary>
 /// Creates a new instance of the
 /// <see cref="Spring.Objects.Factory.Support.RootWebObjectDefinition"/> class
 /// for an .aspx page, providing property values.
 /// </summary>
 /// <param name="pageName">
 /// Name of the .aspx page to instantiate.
 /// </param>
 /// <param name="properties">
 /// The <see cref="Spring.Objects.MutablePropertyValues"/> to be applied to
 /// a new instance of the object.
 /// </param>
 public RootWebObjectDefinition(
     string pageName,
     MutablePropertyValues properties)
     : base(WebObjectUtils.GetPageType(pageName), null, properties)
 {
     _pageName = WebUtils.CombineVirtualPaths(VirtualEnvironment.CurrentExecutionFilePath, pageName);
 }
Esempio n. 2
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 GetPageTypeWithWhitespacedPageName()
 {
     WebObjectUtils.GetPageType("   ");
 }
 public void GetPageTypeWithEmptyStringPageName()
 {
     WebObjectUtils.GetPageType(string.Empty);
 }
 public void GetPageTypeWithNullPageName()
 {
     WebObjectUtils.GetPageType(null);
 }
 public void CreatePageInstanceWhenNotRunningInServerContext()
 {
     Assert.Throws <ObjectCreationException>(() => WebObjectUtils.CreatePageInstance("foo.aspx"));
 }
 public void GetPageTypeWithWhitespacedPageName()
 {
     Assert.Throws <ArgumentNullException>(() => WebObjectUtils.GetPageType("   "));
 }
 public void GetPageTypeWithEmptyStringPageName()
 {
     Assert.Throws <ArgumentNullException>(() => WebObjectUtils.GetPageType(string.Empty));
 }
 public void GetPageTypeWithNullPageName()
 {
     Assert.Throws <ArgumentNullException>(() => WebObjectUtils.GetPageType(null));
 }