/// <summary> /// Creates a new LinqSearchResponse from a base response and that response's entries. /// </summary> /// <param name="response">The native search response object.</param> /// <param name="entries">The entries from the native search response.</param> public LinqSearchResponse( SearchResponse response, IEnumerable entries, IModelCreator modelCreator = null) { modelCreator = modelCreator ?? new ModelCreator(); Native = response; Entries = new List <T>(); if (entries == null) { return; } foreach (dynamic entry in entries) { var converted = modelCreator.Create <T>(entry.Attributes, entry.DistinguishedName); converted.Attributes = entry.Attributes; if (converted is LinqSearchResultEntry sre) { sre.Native = entry; sre.Controls = entry.Controls; } Entries.Add(converted); } }
public LinqDirectorySearcherTests() { Creator = Mock.Of <IModelCreator>(); Searcher = new LinqDirectorySearcher <TestLdapModel>(); Searcher.Base = Mock.Of <IDirectorySearcherProxy>(); Searcher.ModelCreator = Creator; }
/// <summary> /// 初始化数据模型注入 /// </summary> /// <param name="modelBuilder">模型创建者</param> /// <param name="type">所选类型</param> public static void Init(ModelBuilder modelBuilder, Type type) { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies() .Where(s => s.FullName.Contains(StaticConfiguration.ProjectName)).ToArray(); List <Type> typesToRegister = new List <Type>(); Type modelType = type; foreach (var assembly in assemblies) { var types = assembly.GetTypes().Where(s => !String.IsNullOrEmpty(s.Namespace)) .Where(s => s.BaseType != null && !s.IsGenericType && modelType.IsAssignableFrom(s)); typesToRegister.AddRange(types); } if (typesToRegister.Count > 0) { foreach (var t in typesToRegister) { IModelCreator creator = Activator.CreateInstance(t) as IModelCreator; creator.CreateModel(modelBuilder); } } }
public void TestModelCreatorCtorExNullRepository() { Assert.Throws <ArgumentNullException>(() => { _modelCreator = new ModelCreator(null); }); }
public FavouritesController(IModelBuilder <People, IEnumerable <Favourite> > favouritesBuilder, IModelCreator <Favourite> favoritesCreator, IModelDeleter <Favourite> favoritesDeleter) { _favouritesBuilder = favouritesBuilder; _favoritesCreator = favoritesCreator; _favoritesDeleter = favoritesDeleter; }
public HomeController(IBlobClient blobClient, IModelCreator modelCreator, IEloCalulator eloCalulator, ITeamGenerator teamGenerator, ITrendCalculator trendCalculator) { this.blobClient = blobClient; this.modelCreator = modelCreator; this.eloCalulator = eloCalulator; this.teamGenerator = teamGenerator; this.trendCalculator = trendCalculator; }
private static object CreateModel(Type modelType, IModelCreator modelCreator) { var method = typeof(Host).GetMethods(BindingFlags) .Where(m => m.Name == "CreateModel" && m.IsGenericMethod && m.GetGenericArguments().Length == 1) .Select(m => m.MakeGenericMethod(modelType)) .First(); var model = method.Invoke(null, new object[] { modelCreator }); return(model); }
public static IModelCreator CreateModelCreator(string pageTemplate) { TkDebug.AssertArgumentNullOrEmpty(pageTemplate, "pageTemplate", null); TkDebug.ThrowIfNoGlobalVariable(); PageTemplatePlugInFactory factory = BaseGlobalVariable.Current.FactoryManager .GetCodeFactory(REG_NAME).Convert <PageTemplatePlugInFactory>(); IModelCreator creator = factory.InternalCreateModelCreator(pageTemplate); return(creator); }
void GivenABrowser() { _requeueAndRemove = Substitute.For <IRequeueAndRemove>(); _modelCreator = Substitute.For <IModelCreator>(); _commandSender = Substitute.For <ICommandSender>(); Browser = new Browser(with => { with.Module <BusManagerModule>(); with.Dependency(_requeueAndRemove); with.Dependency(_modelCreator); with.Dependency(_commandSender); }); }
public TransManagerFactoryEF(IModelCreator modelCreator) { ModelCreator = modelCreator; }
public LiteDispatchDbContext(IModelCreator modelCreator) : base("DomainDb") { ModelCreator = modelCreator; }
public LiteDispatchMigrationsSqlCeDbContext(IModelCreator modelCreator) : base(modelCreator) { }
private static T CreateModel <T>(IModelCreator modelCreator) { var model = modelCreator.Create <T>(); return(model); }
public void ModelCreatorSetUp() { _repositoryMock = new Mock <IRepository>(); _modelCreator = new ModelCreator(_repositoryMock.Object); }
protected DrawingCpmponent(IModelCreator <T> modelCreator, IViewer <T> viewer) { this.modelCreator = modelCreator; this.viewer = viewer; }
public AxisDrawer(IModelCreator <AxisMathModel> modelCreator, IViewer <AxisMathModel> viewer) : base(modelCreator, viewer) { }
public Context(IContextOptionsProvider contextOptionsProvider, IModelCreator modelCreator) { _contextOptionsProvider = contextOptionsProvider; _modelCreator = modelCreator; }
public LiteDispatchMigrationsDbContext(IModelCreator modelCreator) : base(modelCreator) { }
public eDirectoryDbContext(IModelCreator modelCreator) : base("eDirectory") { ModelCreator = modelCreator; }
public ModelCreatorTests() { ModelCreator = new ModelCreator(); }
public BusManagerModule(IRequeueAndRemove requeueAndRemove, IModelCreator modelCreator, ICommandSender commandSender) : base("/api/v1/busmanager") { _requeueAndRemove = requeueAndRemove; _modelCreator = modelCreator; _commandSender = commandSender; Get["/"] = _ => _modelCreator.Build<Overview>(); Post["/deleteall"] = _ => { _commandSender.Send(new DeleteAllBusEntititesCommand()); return new { success = true }; }; Get["/topic/{tid}"] = _ => _modelCreator.Build<Topic, TopicCriteria>(new TopicCriteria(To.String((object)_.tid))); Get["/queue/{qid}"] = _ => _modelCreator.Build<Queue, QueueCriteria>(new QueueCriteria(To.String((object)_.qid))); Get["/topic/{tid}/{sid}"] = _ => _modelCreator.Build<Subscription, SubscriptionCriteria>(new SubscriptionCriteria(To.String((object)_.tid), To.String((object)_.sid), true)); Get["queue/{qid}/messages/{count}"] = _ => _modelCreator.Build<MessageView, FindQueuedMessages>(new FindQueuedMessages(To.String((object)_.qid).UnescapePathName(), To.Int(_.count))); Get["topic/{tid}/{sid}/messages/{count}"] = _ => _modelCreator.Build<MessageView, FindSubscriptionMessages>(new FindSubscriptionMessages(To.String((object)_.tid), To.String((object)_.sid).UnescapePathName(), To.Int(_.count))); Post["/queue/{qid}/requeue/all"] = _ => { var qid = To.String((object)_.qid).UnescapePathName(); _requeueAndRemove.RequeueAll(qid); return _modelCreator.Build<Queue, QueueCriteria>(new QueueCriteria(qid.RemoveDeadLetterPath(), true)); }; Post["/topic/{tid}/{sid}/requeue/all"] = _ => { var tid = To.String((object)_.tid); var sid = To.String((object)_.sid).UnescapePathName(); _requeueAndRemove.RequeueAll(tid, sid); return _modelCreator.Build<Subscription, SubscriptionCriteria>(new SubscriptionCriteria(tid, sid.RemoveDeadLetterPath(), true)); }; Post["/queue/{qid}/remove/all"] = _ => { var qid = To.String((object)_.qid).UnescapePathName(); _requeueAndRemove.RemoveAll(qid); return _modelCreator.Build<Queue, QueueCriteria>(new QueueCriteria(qid.RemoveDeadLetterPath(), true)); }; Post["/topic/{tid}/{sid}/remove/all"] = _ => { var tid = To.String((object)_.tid); var sid = To.String((object)_.sid).UnescapePathName(); _requeueAndRemove.RemoveAll(tid, sid); return _modelCreator.Build<Subscription, SubscriptionCriteria>(new SubscriptionCriteria(tid, sid.RemoveDeadLetterPath(), true)); }; Post["queue/{qid}/delete"] = _ => { _commandSender.Send(new DeleteQueueCommand(To.String((object)_.qid).UnescapePathName().RemoveDeadLetterPath())); _commandSender.Send(new RefreshCachedOverviewCommand()); return new { success = true }; }; Post["topic/{tid}/delete"] = _ => { _commandSender.Send(new DeleteTopicCommand(To.String((object)_.tid).UnescapePathName())); _commandSender.Send(new RefreshCachedOverviewCommand()); return new { success = true }; }; Post["topic/{tid}/{sid}/delete"] = _ => { _commandSender.Send(new DeleteSubscriptionCommand(To.String((object)_.tid).UnescapePathName(), To.String((object)_.sid).UnescapePathName().RemoveDeadLetterPath())); _commandSender.Send(new RefreshCachedOverviewCommand()); return new { success = true }; }; Post["queue/{qid}/remove"] = _ => { _commandSender.Send(new RemoveMessageCommand(Request.Form.messageId, To.String((object)_.qid).UnescapePathName())); return new { success = true }; }; Post["queue/{qid}/dead/{mid}"] = _ => { _commandSender.Send(new DeadLetterMessageCommand(To.String((object)_.mid), To.String((object)_.qid).UnescapePathName())); return new { success = true }; }; Post["queue/{qid}/dead"] = _ => { _commandSender.Send(new DeadLetterAllMessagesCommand(To.String((object)_.qid).UnescapePathName())); return _modelCreator.Build<Queue, QueueCriteria>(new QueueCriteria(To.String((object)_.qid).RemoveDeadLetterPath(), true)); }; Post["queue/{qid}/requeue"] = _ => { _commandSender.Send(new RequeueMessageCommand(Request.Form.messageId, To.String((object)_.qid).UnescapePathName())); return new { success = true }; }; Post["queue/{qid}/requeueModified"] = _ => { _commandSender.Send(new RequeueMessageCommand(Request.Form.messageId, To.String((object)_.qid).UnescapePathName()) { NewBody = Request.Form.body}); return new { success = true }; }; Post["topic/{tid}/{sid}/remove"] = _ => { _commandSender.Send(new RemoveMessageCommand(Request.Form.messageId, To.String((object)_.tid), To.String((object)_.sid).UnescapePathName())); return new { success = true }; }; Post["topic/{tid}/{sid}/dead/{mid}"] = _ => { _commandSender.Send(new DeadLetterMessageCommand(To.String((object)_.mid), To.String((object)_.tid), To.String((object)_.sid).UnescapePathName())); return new { success = true }; }; Post["topic/{tid}/{sid}/dead"] = _ => { _commandSender.Send(new DeadLetterAllMessagesCommand(To.String((object)_.tid), To.String((object)_.sid).UnescapePathName())); return _modelCreator.Build<Subscription, SubscriptionCriteria>(new SubscriptionCriteria(To.String((object)_.tid), To.String((object)_.sid).UnescapePathName(), true)); }; Post["topic/{tid}/{sid}/requeue"] = _ => { _commandSender.Send(new RequeueMessageCommand(Request.Form.messageId,To.String( _.tid), To.String((object)_.sid).UnescapePathName())); return new { success = true }; }; Post["topic/{tid}/{sid}/requeueModified"] = _ => { _commandSender.Send(new RequeueMessageCommand(Request.Form.messageId, To.String(_.tid), To.String((object)_.sid).UnescapePathName()) { NewBody = Request.Form.body }); return new { success = true }; }; Post["queue/{qid}"] = _ => { _commandSender.Send(new SendMessageCommand(To.String((object)_.qid).UnescapePathName(), this.Bind<Message>())); return new { success = true }; }; Post["topic/{tid}"] = _ => { _commandSender.Send(new PublishMessageCommand(To.String((object)_.tid).UnescapePathName(), this.Bind<Message>())); return new { success = true }; }; }
public Interactor(IModelCreator modelCreator) { _modelCreator = modelCreator ?? throw new ArgumentNullException(nameof(modelCreator)); }
public BusManagerModule(IRequeueAndRemove requeueAndRemove, IModelCreator modelCreator, ICommandSender commandSender) : base("/api/v1/busmanager") { _requeueAndRemove = requeueAndRemove; _modelCreator = modelCreator; _commandSender = commandSender; Get["/"] = _ => _modelCreator.Build <Overview>(); Post["/deleteall"] = _ => { _commandSender.Send(new DeleteAllBusEntititesCommand()); return(new { success = true }); }; Post["/deletealldeadletters"] = _ => { _commandSender.Send(new DeleteAllDeadLettersCommand()); return(new { success = true }); }; Get["/deadletters"] = _ => _modelCreator.Build <DeadletterView>(); Get["/topic/{tid}"] = _ => _modelCreator.Build <Topic, TopicCriteria>(new TopicCriteria(To.String((object)_.tid))); Get["/queue/{qid}"] = _ => _modelCreator.Build <Queue, QueueCriteria>(new QueueCriteria(To.String((object)_.qid))); Get["/topic/{tid}/{sid}"] = _ => _modelCreator.Build <Subscription, SubscriptionCriteria>(new SubscriptionCriteria(To.String((object)_.tid), To.String((object)_.sid), true)); Get["queue/{qid}/messages/{count}"] = _ => _modelCreator.Build <MessageView, FindQueuedMessages>(new FindQueuedMessages(To.String((object)_.qid).UnescapePathName(), To.Int(_.count))); Get["topic/{tid}/{sid}/messages/{count}"] = _ => _modelCreator.Build <MessageView, FindSubscriptionMessages>(new FindSubscriptionMessages(To.String((object)_.tid), To.String((object)_.sid).UnescapePathName(), To.Int(_.count))); Post["/queue/{qid}/requeue/all"] = _ => { var qid = To.String((object)_.qid).UnescapePathName(); _requeueAndRemove.RequeueAll(qid); return(_modelCreator.Build <Queue, QueueCriteria>(new QueueCriteria(qid.RemoveDeadLetterPath(), true))); }; Post["/topic/{tid}/{sid}/requeue/all"] = _ => { var tid = To.String((object)_.tid); var sid = To.String((object)_.sid).UnescapePathName(); _requeueAndRemove.RequeueAll(tid, sid); return(_modelCreator.Build <Subscription, SubscriptionCriteria>(new SubscriptionCriteria(tid, sid.RemoveDeadLetterPath(), true))); }; Post["/queue/{qid}/remove/all"] = _ => { var qid = To.String((object)_.qid).UnescapePathName(); _requeueAndRemove.RemoveAll(qid); return(_modelCreator.Build <Queue, QueueCriteria>(new QueueCriteria(qid.RemoveDeadLetterPath(), true))); }; Post["/topic/{tid}/{sid}/remove/all"] = _ => { var tid = To.String((object)_.tid); var sid = To.String((object)_.sid).UnescapePathName(); _requeueAndRemove.RemoveAll(tid, sid); return(_modelCreator.Build <Subscription, SubscriptionCriteria>(new SubscriptionCriteria(tid, sid.RemoveDeadLetterPath(), true))); }; Post["queue/{qid}/delete"] = _ => { _commandSender.Send(new DeleteQueueCommand(To.String((object)_.qid).UnescapePathName().RemoveDeadLetterPath())); _commandSender.Send(new RefreshCachedOverviewCommand()); return(new { success = true }); }; Post["topic/{tid}/delete"] = _ => { _commandSender.Send(new DeleteTopicCommand(To.String((object)_.tid).UnescapePathName())); _commandSender.Send(new RefreshCachedOverviewCommand()); return(new { success = true }); }; Post["topic/{tid}/{sid}/delete"] = _ => { _commandSender.Send(new DeleteSubscriptionCommand(To.String((object)_.tid).UnescapePathName(), To.String((object)_.sid).UnescapePathName().RemoveDeadLetterPath())); _commandSender.Send(new RefreshCachedOverviewCommand()); return(new { success = true }); }; Post["queue/{qid}/remove"] = _ => { _commandSender.Send(new RemoveMessageCommand(Request.Form.messageId, To.String((object)_.qid).UnescapePathName())); return(new { success = true }); }; Post["queue/{qid}/dead/{mid}"] = _ => { _commandSender.Send(new DeadLetterMessageCommand(To.String((object)_.mid), To.String((object)_.qid).UnescapePathName())); return(new { success = true }); }; Post["queue/{qid}/dead"] = _ => { _commandSender.Send(new DeadLetterAllMessagesCommand(To.String((object)_.qid).UnescapePathName())); return(_modelCreator.Build <Queue, QueueCriteria>(new QueueCriteria(To.String((object)_.qid).RemoveDeadLetterPath(), true))); }; Post["queue/{qid}/requeue"] = _ => { _commandSender.Send(new RequeueMessageCommand(Request.Form.messageId, To.String((object)_.qid).UnescapePathName())); return(new { success = true }); }; Post["queue/{qid}/requeueModified"] = _ => { _commandSender.Send(new RequeueMessageCommand(Request.Form.messageId, To.String((object)_.qid).UnescapePathName()) { NewBody = Request.Form.body }); return(new { success = true }); }; Post["topic/{tid}/{sid}/remove"] = _ => { _commandSender.Send(new RemoveMessageCommand(Request.Form.messageId, To.String((object)_.tid), To.String((object)_.sid).UnescapePathName())); return(new { success = true }); }; Post["topic/{tid}/{sid}/dead/{mid}"] = _ => { _commandSender.Send(new DeadLetterMessageCommand(To.String((object)_.mid), To.String((object)_.tid), To.String((object)_.sid).UnescapePathName())); return(new { success = true }); }; Post["topic/{tid}/{sid}/dead"] = _ => { _commandSender.Send(new DeadLetterAllMessagesCommand(To.String((object)_.tid), To.String((object)_.sid).UnescapePathName())); return(_modelCreator.Build <Subscription, SubscriptionCriteria>(new SubscriptionCriteria(To.String((object)_.tid), To.String((object)_.sid).UnescapePathName(), true))); }; Post["topic/{tid}/{sid}/requeue"] = _ => { _commandSender.Send(new RequeueMessageCommand(Request.Form.messageId, To.String(_.tid), To.String((object)_.sid).UnescapePathName())); return(new { success = true }); }; Post["topic/{tid}/{sid}/requeueModified"] = _ => { _commandSender.Send(new RequeueMessageCommand(Request.Form.messageId, To.String(_.tid), To.String((object)_.sid).UnescapePathName()) { NewBody = Request.Form.body }); return(new { success = true }); }; Post["queue/{qid}"] = _ => { _commandSender.Send(new SendMessageCommand(To.String((object)_.qid).UnescapePathName(), this.Bind <Message>())); return(new { success = true }); }; Post["topic/{tid}"] = _ => { _commandSender.Send(new PublishMessageCommand(To.String((object)_.tid).UnescapePathName(), this.Bind <Message>())); return(new { success = true }); }; }
public DefaultRequestInfoBuilder(IModelCreator modelCreator, IOptions <HttpReportsOptions> options) : base(modelCreator, options) { }
public DIContractResolver(IModelCreator creator) { _creator = creator; }
public DIObjectConstructor(Type type, IModelCreator creator) { _type = type; _creator = creator; }
public BaseRequestInfoBuilder(IModelCreator modelCreator, IOptions <HttpReportsOptions> options) { Options = options.Value; ModelCreator = modelCreator; }
public DomainDbManager(LiteDispatchDbContext context) { ModelCreator = context.ModelCreator; }