protected void CreateWork <T1, T2, T3, T4, T5, T6, T7, T8>(string name, object state = null, UiAttribute ui = null, AuthenticateAttribute authenticate = null, AuthorizeAttribute authorize = null, BeforeAttribute before = null, AfterAttribute after = null) where T1 : WebWork, new() where T2 : WebWork, new() where T3 : WebWork, new() where T4 : WebWork, new() where T5 : WebWork, new() where T6 : WebWork, new() where T7 : WebWork, new() where T8 : WebWork, new() { CreateWork <T1>(name, state, ui, authenticate, authorize, before, after); CreateWork <T2>(name, state, ui, authenticate, authorize, before, after); CreateWork <T3>(name, state, ui, authenticate, authorize, before, after); CreateWork <T4>(name, state, ui, authenticate, authorize, before, after); CreateWork <T5>(name, state, ui, authenticate, authorize, before, after); CreateWork <T6>(name, state, ui, authenticate, authorize, before, after); CreateWork <T7>(name, state, ui, authenticate, authorize, before, after); CreateWork <T8>(name, state, ui, authenticate, authorize, before, after); }
/// <summary> /// Create and add a fixed-key subwork. /// </summary> /// <param name="name">the identifying name for the work</param> /// <param name="state"></param> /// <param name="ui">to override class-wise UI attribute</param> /// <param name="authenticate"></param> /// <param name="authorize">to override class-wise Authorize attribute</param> /// <param name="before"></param> /// <param name="after"></param> /// <typeparam name="T">the type of work to create</typeparam> /// <returns>The newly created and subwork instance.</returns> /// <exception cref="WebException">Thrown if error</exception> protected T CreateWork <T>(string name, object state = null, UiAttribute ui = null, AuthenticateAttribute authenticate = null, AuthorizeAttribute authorize = null, BeforeAttribute before = null, AfterAttribute after = null) where T : WebWork, new() { if (works == null) { works = new Map <string, WebWork>(); } var wrk = new T { Name = name, Service = Service, Parent = this, Level = Level + 1, IsVar = false, Directory = (Parent == null) ? name : Path.Combine(Parent.Directory, name), Pathing = Pathing + name + "/", State = state }; if (ui != null) { wrk.Ui = ui; } if (authenticate != null) { wrk.Authenticate = authenticate; } if (authorize != null) { wrk.Authorize = authorize; } if (before != null) { wrk.Before = before; } if (after != null) { wrk.After = after; } works.Add(wrk); wrk.OnCreate(); return(wrk); }
protected void CreateWork <T1, T2, T3>(string name, object state = null, UiAttribute ui = null, AuthenticateAttribute authenticate = null, AuthorizeAttribute authorize = null, BeforeAttribute before = null, AfterAttribute after = null) where T1 : WebWork, new() where T2 : WebWork, new() where T3 : WebWork, new() { CreateWork <T1>(name, state, ui, authenticate, authorize, before, after); CreateWork <T2>(name, state, ui, authenticate, authorize, before, after); CreateWork <T3>(name, state, ui, authenticate, authorize, before, after); }
/// <summary> /// Create and add a variable-key subwork. /// </summary> /// <param name="accessor">to resolve key from the principal object</param> /// <param name="state"> </param> /// <param name="ui">to override class-wise UI attribute</param> /// <param name="authenticate"></param> /// <param name="authorize">to override class-wise Authorize attribute</param> /// <param name="before"></param> /// <param name="after"></param> /// <typeparam name="T"></typeparam> /// <returns>The newly created subwork instance.</returns> /// <exception cref="WebException">Thrown if error</exception> protected T CreateVarWork <T>(Func <IData, string, object> accessor = null, object state = null, UiAttribute ui = null, AuthenticateAttribute authenticate = null, AuthorizeAttribute authorize = null, BeforeAttribute before = null, AfterAttribute after = null) where T : WebWork, new() { var wrk = new T { Service = Service, Parent = this, Level = Level + 1, IsVar = true, Directory = (Parent == null) ? VARDIR : Path.Combine(Parent.Directory, VARDIR), Pathing = Pathing + (accessor == null ? VARPATHING : string.Empty) + "/", Accessor = accessor, State = state }; if (ui != null) { wrk.Ui = ui; } if (authenticate != null) { wrk.Authenticate = authenticate; } if (authorize != null) { wrk.Authorize = authorize; } if (before != null) { wrk.Before = before; } if (after != null) { wrk.After = after; } varwork = wrk; wrk.OnCreate(); return(wrk); }