public async Task <IEnumerable <Event> > GetEventsByReunionIdAsync(Guid reunionId) { ParameterDictionary parameters = ParameterDictionary.Single("reunionId", reunionId.ToString()); return(await ExecuteStoredProc("[dbo].[spGetEventsByReunionId]", parameters) .ConfigureAwait(continueOnCapturedContext: false)); }
public async Task CancelReunionAsync(CancelRequest request) { ParameterDictionary parameters = ParameterDictionary.Single("reunionId", request.EntityId); _ = await ExecuteStoredProc("[dbo].[spDeleteReunionById]", parameters) .ConfigureAwait(continueOnCapturedContext: false); }
public RequestContext(IServerContext context, Router router, Route route, ParameterDictionary routeparams) { Context=context; Router=router; Route=route; RouteParams=routeparams; }
private ParameterDictionary <DependencyData> BuildConstructorParameters(ConstructorInfo constructor) { // NOTE: We used to use a LINQ query here (which is cleaner code), but we reverted back to using // a foreach statement to clean up the stack trace, since this is a very common code path to // show up in the stack trace and preventing showing up the Enumerable and Buffer`1 calls here // makes it easier for developers (and maintainers) to read the stack trace. var parameters = new ParameterDictionary <DependencyData>(); foreach (ParameterInfo parameter in constructor.GetParameters()) { var consumer = new InjectionConsumerInfo(parameter); Expression expression = this.GetPlaceHolderFor(parameter); InstanceProducer?producer = null; if (expression is null) { producer = this.Container.Options.GetInstanceProducerFor(consumer); expression = producer.BuildExpression(); } parameters.Add(parameter, new DependencyData(parameter, expression, producer)); } return(parameters); }
/// <summary> /// 設定Output數值 /// </summary> /// <param name="bitNum">Bit Number</param> /// <param name="status">寫入成功回傳true,反之false(DI點一定false)</param> /// <returns></returns> public bool SetOutput(ushort bitNum, bool status) { if (dIOPara.IsActive) { if (ParameterDictionary.GetValue("DO7062BlockScan") == "true") { Status1[bitNum] = status; Status2[bitNum / 8, bitNum % 8] = status; } else { Stopwatch sw = Stopwatch.StartNew(); ushort uValue = (ushort)(status ? 1 : 0); ushort uRet = CEtherCAT_DLL.CS_ECAT_Slave_DIO_Set_Single_Output_Value(dIOPara.CardNo, dIOPara.NodeNo, g_uESCSlotID, bitNum, uValue); if (uRet != CEtherCAT_DLL_Err.ERR_ECAT_NO_ERROR) { throw new Exception("CS_ECAT_Slave_DIO_Set_Single_Output_Value, " + GetEtherCATErrorCode(uRet)); } sw.Stop(); //LogHelper.Debug("{0} SetOutput TACT {1}", this.DeviceName, sw.ElapsedMilliseconds); } return(true); } else { return(false); } }
public void ParameterDictionary_Index_NonExistentKey_Success() { var dictionary = new ParameterDictionary(); Assert.IsNotNull(dictionary, "The parameter dictionary should not be null"); Assert.IsNull(dictionary["non_existent_key"], "A non-existent key should have returned null"); }
public async Task <AttendeeInvite> GetInviteAsync(InviteInfo inviteInfo) { ParameterDictionary parameters = ParameterDictionary.Single("inviteId", inviteInfo.InviteId); return((await ExecuteStoredProc("[dbo].[spGetInviteById]", parameters) .ConfigureAwait(continueOnCapturedContext: false)).FirstOrDefault()); }
public async Task <IEnumerable <AttendeeInvite> > GetAttendeesByReunion(Guid reunionId) { ParameterDictionary parameters = ParameterDictionary.Single("reunionId", reunionId); return(await ExecuteStoredProc("[dbo].[spGetInvitesByReunionId]", parameters) .ConfigureAwait(continueOnCapturedContext: false)); }
public RenderingItem([CanBeNull] IRenderingContainer renderingContainer, [NotNull] IItem item) { Assert.ArgumentNotNull(item, nameof(item)); RenderingContainer = renderingContainer; Name = item.Name; Cacheable = false; Conditions = string.Empty; DataSource = string.Empty; ItemId = item.ItemUri.ItemId.ToString(); MultiVariateTests = string.Empty; Parameters = string.Empty; PlaceholderKey = new PlaceHolderKey(string.Empty); UniqueId = Guid.NewGuid().Format(); VaryByData = false; VaryByDevice = false; VaryByLogin = false; VaryByParameters = false; VaryByQueryString = false; VaryByUser = false; PlaceHolders = string.Empty; DataSourceLocation = string.Empty; DataSourceTemplate = string.Empty; FilePath = string.Empty; ParameterTemplateId = string.Empty; Ruleset = string.Empty; SpeakCoreVersion = string.Empty; SpeakCoreVersionId = string.Empty; ParameterDictionary = new ParameterDictionary(new Dictionary <string, string>()); Icon = item.Icon; ItemUri = item.ItemUri; }
public frmMain(string[] args) { Parameter = new ParameterDictionary(); NomiRegEx = new ListNameRegEx(); InitializeComponent(); Logger.Setup(Parameter.GetBool("LogOn")); PileSwLib.PileSwLib.OnUpdatePosition += SwPileUtil_OnUpdatePosition; //Set logs da fare subito PileSwLib.UtilTest.UtilTestLib.SetLog(log); //SwPileLib PileSwLib.PileSwLib.SetLog(log); //SwPileLibUtil //-------------------------- PileSwLib.PileSwLib.UseWMI = false; // Properties.Settings.Default.UseWMI; PileSwLib.PileSwLib.SetServiceConfig(Parameter.StrCfg); //Start Work bw.DoWork += bw_DoWork; if (bw.IsBusy != true) { bw.RunWorkerAsync(); } toolStrip1_Resize(this, new EventArgs()); log.Warn("Started at " + DateTime.Now.ToString() + " " + SystemInformation.UserName); SetChmFile(); if (args.Count() > 0) { FileDaAprire = args[0]; } }
public async Task <IEnumerable <User> > GetReunionOrganizers(Guid reunionId) { ParameterDictionary parameters = ParameterDictionary.Single("reunionId", reunionId); return(await ExecuteStoredProc("[dbo].[spGetOrganizersByReunionId]", parameters) .ConfigureAwait(continueOnCapturedContext: false)); }
public async Task <Address> GetEventAddressAsync(Guid eventId) { ParameterDictionary parameters = ParameterDictionary.Single("eventId", eventId.ToString()); return((await ExecuteStoredProc("[dbo].[spGetAddressByEventId]", parameters) .ConfigureAwait(continueOnCapturedContext: false)).SingleOrDefault()); }
/// <inheritdoc /> public async Task <Video> UploadPullLinkAsync(string link) { try { var param = new ParameterDictionary { { "type", "pull" }, { "link", link } }; var request = _apiRequestFactory.AuthorizedRequest( AccessToken, HttpMethod.Post, Endpoints.UploadTicket, null, param ); return(await ExecuteApiRequest <Video>(request).ConfigureAwait(false)); } catch (Exception ex) { if (ex is VimeoApiException) { throw; } throw new VimeoUploadException("Error generating upload ticket.", null, ex); } }
public async Task <Reunion> GetReunionAsync(Guid id) { ParameterDictionary parameters = ParameterDictionary.Single("id", id.ToString()); return((await ExecuteStoredProc("[dbo].[spGetReunionById]", parameters) .ConfigureAwait(continueOnCapturedContext: false)).SingleOrDefault()); }
public async Task <FdaLabelSearchResults> SearchAsync(FdaLabelSearchOptions fdaLabelSearchOptions, PagingSortingOptions pagingOptions = null, string joiner = "AND") { if (pagingOptions == null) { pagingOptions = new PagingSortingOptions(); } var parameterDictionary = new ParameterDictionary { { "search", fdaLabelSearchOptions.ToQuery(joiner) } }; if (pagingOptions.Limit != 0) { parameterDictionary.Add("limit", pagingOptions.Limit.ToString()); } if (pagingOptions.Skip != 0) { parameterDictionary.Add("skip", pagingOptions.Skip.ToString()); } if (!string.IsNullOrEmpty(_apiKey)) { parameterDictionary.Add("api_key", _apiKey); } var json = await GetAsync($"/drug/label.json?{parameterDictionary.ToQueryString()}"); return(FdaLabelSearchResults.FromJson(json)); }
public void ParameterDictionary_Index_ExistingValue_Success() { var dictionary = new ParameterDictionary(); dictionary["test"] = 1; Assert.AreEqual(1, dictionary["test"], "An existing value was not returned correctly"); }
private void AddRelationships(ConstructorInfo constructor, ParameterDictionary <DependencyData> parameters) { var knownRelationships = from dependency in parameters.Values select dependency.Producer ?? this.GetOverriddenParameterFor(dependency.Parameter).Producer; this.AddRelationships(constructor.DeclaringType, knownRelationships); }
public void ParameterDictionary_Index_NotNullNullable_Success() { var dictionary = new ParameterDictionary(); dictionary["nullable"] = new int?(3); Assert.AreEqual(3, dictionary["nullable"], "The non-null Nullable<?> item should have returned its value"); }
public async Task <Address> GetReunionAddressAsync(Guid reunionId) { ParameterDictionary parameters = ParameterDictionary.Single("entityTypeId", (int)EntityType.Reunion); parameters.AddParameter("entityId", reunionId.ToString()); return((await ExecuteStoredProc("[dbo].[spGetAddressByEntityTypeAndId]", parameters) .ConfigureAwait(continueOnCapturedContext: false)).SingleOrDefault()); }
public RunCommand(RenderParams renderParams = RenderParams.AsSlash) { _params = new ParameterDictionary(); Arguments = string.Empty; _renderParams = renderParams; Out = Console.Out; Error = Console.Error; }
public object Convert(string key, ParameterDictionary d) { if(d.ContainsKey(key)) { return true; }else{ return false; } }
public void ParameterDictionary_Constructor_Success() { var dictionary = new ParameterDictionary("test", 8); Assert.IsNotNull(dictionary, "The dictionary should not be null"); Assert.AreEqual(1, dictionary.Count, "There should be 1 entry in the dictionary"); Assert.IsTrue(dictionary.ContainsKey("test"), "The key was not populated"); Assert.AreEqual(8, dictionary["test"], "The value was not populated"); }
public async Task AddAttendees(BulkAttendeeRequest request) { ParameterDictionary parameters = ParameterDictionary.Single("invites", TvpHelper.MapInvites(request.InviteRequests)); parameters.AddParameter("userId", request.UserId); await ExecuteStoredProc("[dbo].[spCreateInvites]", parameters) .ConfigureAwait(continueOnCapturedContext: false); }
public override string ToString(out ParameterDictionary parameters) { parameters = new ParameterDictionary { { _key, _value } }; return(ToString()); }
private void CheckParameters() { if (this.parameters == null) { this.parameters = new ParameterDictionary(this); this.parameters.ItemAdded += new EventHandler <EventArgsR1 <IIntermediateDelegateTypeParameterMember> >(parameters_ItemAdded); this.parameters.ItemRemoved += new EventHandler <EventArgsR1 <IIntermediateDelegateTypeParameterMember> >(parameters_ItemRemoved); } }
public async Task AttendeeResponseAsync(Guid inviteId, Constants.AttendeeResponseStatus status) { ParameterDictionary parameters = new ParameterDictionary(); parameters.AddParameter("inviteId", inviteId); parameters.AddParameter("status", (int)status); await ExecuteStoredProc("[dbo].[spUpdateStatus]", parameters) .ConfigureAwait(continueOnCapturedContext: false); }
public void ParameterDictionary_Index_NullNullable_Success() { int?nullableInt = null; var dictionary = new ParameterDictionary(); dictionary["nullable"] = nullableInt; Assert.IsNull(dictionary["nullable"], "The null Nullable<?> item should have returned null"); }
public async Task CancelEventAsync(CancelRequest request) { ParameterDictionary parameters = new ParameterDictionary(new string[] { "userId", request.UserId, "eventId", request.EntityId.ToString() }); await ExecuteStoredProc("[dbo].[spCancelEventById]", parameters).ConfigureAwait(continueOnCapturedContext: false); }
public string GetParameter(string key) { string value; if (ParameterDictionary.TryGetValue(key, out value)) { return(value); } return(null); }
public static IOSChannel GetIOSChannel(this MessageChannelEntity pChannel) { if (pChannel.MobilePlatform == 1) { throw new Exception("不能创建BaiduChannel,方法选择错误"); } IOSChannel channel = pChannel.Settings.DeserializeJSONTo <IOSChannel>(); ParameterDictionary dictionary = new ParameterDictionary(); return(channel); }
public void EmptyTest4() { var source = new ParameterDictionary(); source["EIN"] = ""; source["Password"] = ""; var dst = Mapper.Map <IDictionary <string, string>, Account>(source); Assert.IsNotNull(dst); }
public async Task RemoveReunionOrganizer(Guid reunionId, string email) { ParameterDictionary parameters = new ParameterDictionary(new string[] { "reunionId", reunionId.ToString(), "email", email }); _ = await ExecuteStoredProc("[dbo].[spRemoveReunionOrganizer]", parameters) .ConfigureAwait(continueOnCapturedContext: false); }
public virtual string ToString(out ParameterDictionary parameters) { parameters = new ParameterDictionary(); foreach (var clause in Clauses) { clause.ToString(out ParameterDictionary clauseParameters); parameters = parameters.Union(clauseParameters).ToParameterDictionary(); } return(ToString()); }
public void InitNodeFromDescriptor(NodeDescriptor descriptor) { nodeType = descriptor.nodeType; nodeName = descriptor.nodeName; titleBarColor = descriptor.titleBarColor; timePointer = new TimePointer(); timePointer.hasTiming = descriptor.hasTiming; timePointer.InitTimePointer(descriptor.defaultAnimationLength); timePointer.parentNode = this; dragButton = new DragButton(); dragButton.InitDragButton(); parameters = new ParameterDictionary(); foreach (KeyValuePair<string, NodeParameter> pair in descriptor.parameters) { NodeParameter tempParameter = new NodeParameter(); tempParameter.floatParam = pair.Value.floatParam; tempParameter.stringParam = pair.Value.stringParam; tempParameter.vectorParam = new Vector3(pair.Value.vectorParam.x, pair.Value.vectorParam.y, pair.Value.vectorParam.z); tempParameter.type = pair.Value.type; parameters.Add(pair.Key, tempParameter); } for(int i = 0; i < descriptor.numberOfInputs; i++) { nodeInputs.Add(new NodeInput()); } numberOfInputs = descriptor.numberOfInputs; nodeInputsMin = descriptor.minInputs; nodeInputsMax = descriptor.maxInputs; for (int i = 0; i < descriptor.numberOfOutputs; i++) { nodeOutputs.Add(new NodeOutput()); if(nodeType != NodeType.Graph) nodeOutputs[i].outputNode = this; } numberOfOutputs = descriptor.numberOfOutputs; nodeOutputsMin = descriptor.minOutputs; nodeOutputsMax = descriptor.maxOutputs; multiInput = descriptor.isMultiInput; multiOutput = descriptor.isMultiOutput; nodeRect = new Rect(10f, 10f, 150f, 100f); }
public void Execute_ChecksValidatorsForBadParameters() { var router=new Router(); var parameters = new ParameterDictionary(); parameters.Add("id", "1234"); var badvalidators = new List<RouteParamsMustMatch>(); badvalidators.Add(x => x["id"] == "xxx"); var bad=new Route { Responder=(RequestContext c, ref bool skip) => new WrapperView("bad"), Pattern=new FakePatternMatcher("/foo/1234", parameters), ParameterValidators=badvalidators }; router.AddRoute(bad); var context=new FakeServerContext(); context.RequestUrl=new Uri("http://meh.com/foo/1234"); context.HttpMethod="get"; Assert.IsFalse(router.Execute(context)); }
/// <summary> /// Adds Tracing via Log.Verbose.Write to any Intercepted class /// </summary> /// <param name="invocation"></param> public void Intercept(IInvocation invocation) { int threadId = Thread.CurrentThread.ManagedThreadId; MethodInfo method = invocation.Method; ParameterInfo[] parameters = method.GetParameters(); var parameterdictionary = new ParameterDictionary<string, object>(); for (int i = 0; i < invocation.Arguments.Length; i++) { parameterdictionary[parameters[i].Name] = invocation.Arguments[i]; } var cp = new CallProperties { HasReturnValue = method.ReturnType != typeof(void), MethodName = method.Name, ServiceName = name, Parameters = parameterdictionary, ReturnValue = method.ReturnType != typeof(void) ? invocation.ReturnValue : null }; Logger.Verbose.Write("T{0}\t{1} Enter, Call Properties: {2}", threadId, method.ToString(), cp); try { invocation.Proceed(); cp.ReturnValue = method.ReturnType != typeof(void) ? invocation.ReturnValue : null; if (cp.ReturnValue != null) Logger.Verbose.Write("T{0}\t{1} Returning {2}", threadId, method.Name, cp.ReturnValue.ToString()); else Logger.Verbose.Write("T{0}\t{1} Exit", threadId, method.Name); } catch (Exception e) { Logger.Error.Write(e); throw; } }
/**This method returns true(and populates Params) if the input string matches the Pattern string. **/ public MatchResult Match(string input) { var Params=new ParameterDictionary(); string s=input; if(Groups.Count==0){ throw new ApplicationException("Groups.Count==0 matches all. This shouldn't happen"); } foreach(var g in Groups){ if(!g.IsParam){ if(g.Text.Length>=s.Length){ if(Groups[Groups.Count-1]==g){ return new MatchResult(g.Text==s, Params); //to check for exact matches(but only for the last group) }else{ if(g.Optional){ return new MatchResult(true, Params); }else{ return new MatchResult(false, Params); } } } string tmp=CutString(s,0,g.Text.Length); if(g.Text==tmp){ s=s.Substring(g.Text.Length); }else{ return new MatchResult(false, Params); } }else{ int end; if(g.End=='\0'){ end=s.Length; }else{ end=s.IndexOf(g.End); if(end==-1){ return new MatchResult(false, Params); } } if(g.MatchAll){ if(s.Substring(0,end)==""){ return new MatchResult(false, Params); } int slash=s.IndexOf('/'); if(slash==-1 || g.Optional){ if(g.MatchType!=null) { if(!g.MatchType.IsMatch(s.Substring(0,end))) { return new MatchResult(false, Params); } } //Params.Add(g.ParamName, new List<string>()); //Params[g.ParamName]=s.Substring(0,end); Params.Add(g.ParamName, s.Substring(0,end)); s=""; //doesn't matter. }else{ if(g.MatchType!=null) { if(!g.MatchType.IsMatch(s.Substring(0,slash))) { return new MatchResult(false, Params); } } Params.Add(g.ParamName,s.Substring(0,slash)); s=s.Substring(slash); //doesn't matter. } }else{ string t=s.Substring(0,end); bool matched=false; foreach(var match in g.ValidMatches){ if(match==t){ matched=true; //break; } } if(matched==false){ return new MatchResult(false, Params); } if(g.MatchType!=null) { if(!g.MatchType.IsMatch(t)) { return new MatchResult(false, Params); } } Params.Add(g.ParamName,t); s=s.Substring(end); } } } if(s.Length!=0){ return new MatchResult(false, Params); }else{ return new MatchResult(true, Params); } }
public void WithRouteParamLike_AddsValidatorToRoute() { var r=new Router(); var ctrl=r.Controller<TestController>(null); var tmp=ctrl.Handles("/foo/{id}"); tmp.WithRouteParamLike("id", (x) => { int tmpout; return int.TryParse(x, out tmpout); }); var p = new ParameterDictionary(); p.Add("id", "123"); Assert.IsTrue(r.GetRoutes()[0].ParameterValidators.First()(p)); }
public MatchResult(bool ismatch, ParameterDictionary matchparams=null) { Params=matchparams; IsMatch=ismatch; }
public void FromXXX_Should_Populate_Model_In_An_Additive_Manner() { var r = new Router(); var ctrl = r.Controller(c => new TestController(c)); var foo = ctrl.Handles("/foo"). UsingModel(c => new TestModel()). FromForm(). FromRoute(). With((c, m) => c.TestWithModel(m)); bool skip = false; var formparams=new ParameterDictionary(); formparams.Add("Foo", new string[]{"bar"}); var context = new FakeServerContext(); context.Form = formparams; var routeparams = new ParameterDictionary(); routeparams.Add("Bar", new string[]{"baz"}); var view=foo.Current.Responder( new RequestContext(context, null, null, routeparams), ref skip); Assert.AreEqual("foobarbaz", view.ToString()); }
public object Convert(string key, ParameterDictionary d) { return System.Web.HttpUtility.UrlEncodeUnicode(d[key]); }
public object Convert(string key, ParameterDictionary d) { return DateTime.Parse(d[key]); }
public object Convert(string key, ParameterDictionary dictionary) { return new List<string>(dictionary[key].Split(new char[]{' '}, StringSplitOptions.RemoveEmptyEntries)); }
public FakePatternMatcher(string pattern, ParameterDictionary param=null) { Pattern=pattern; Params=param; }