/// <summary> /// 加入参数列表 /// </summary> /// <param name="myParameters">参数数组</param> /// <param name="type">类型</param> /// <param name="name">变量名</param> /// <param name="value">变量值</param> public static List <MyParameter> Add(this List <MyParameter> myParameters, string name, DbType type, object value, string source) { if (!name.StartsWith("@")) { name = "@" + name; } MyParameter myParameter = myParameters.Find(p => p.Name.Equals(name)); if (myParameter == null) { myParameter = new MyParameter(); myParameters.Add(myParameter); } myParameter.Name = name; myParameter.Type = (int)type; //myParameter.Value = value ?? DBNull.Value ; if (!string.IsNullOrEmpty(source)) { myParameter.Source = source; } if (value != null) { myParameter.Value = value; } return(myParameters); }
public override void When() { clientParameter = new MyClientParameter(FormattableString.Invariant($"http://mydomain.com/customers/{GrandParentId}/{WeirdUncleId}/{ParentId}/{Id}"), 3, "http://www.anothersite.com"); var json = JsonConvert.SerializeObject(clientParameter); deserialized = (MyParameter) new JsonDeserializer(typeof(MyParameter), t => "customers/{grandParentId}/{weirdUncleId}/{parentId}/{id}").Deserialize(json.ToStream()); }
public override void When() { clientParameter = new MyClientParameter($"http://mydomain.com/customers/{ObjectId}", 3, "http://www.anothersite.com"); var json = JsonConvert.SerializeObject(clientParameter); deserialized = (MyParameter) new JsonDeserializer(typeof(MyParameter), t => "customers/{Id}").Deserialize(json.ToStream()); }
public void CreateOwnedDependency() { var parameter = new MyParameter(); using (var owned = ownedDependencyFactory(dependency1Factory(parameter))) { } }
public override void UpdateParameter() { if (Value == null || Value.IsDisposed) { Value = LoadTexture(Path); } MyParameter.SetValue(get()); base.UpdateParameter(); }
private MyParameter GetParameter(ParameterInfo parameterSymbol, Assembly definingAssembly, ISymbol parent) { var parameter = new MyParameter(parameterSymbol.Name, parameterSymbol.Position) { Parent = parent, }; parameter.Type = GetType(parameterSymbol.ParameterType, definingAssembly, parameter); return(parameter); }
//Отобразить выбранную группу из CheckBox public void CommandCheckAction(object o) { TypeGroup = o as MyParameter; foreach (var el in ListParameterCollection) { if (el.def.OwnerGroup.Name == TypeGroup.Group) { el.IsCollapsed = false; } else { el.IsCollapsed = true; } } }
/// <summary> /// 加入参数列表 /// </summary> /// <typeparam name="T">类型</typeparam> /// <param name="myParameters">参数</param> /// <param name="entity">实体</param> /// <returns></returns> public static List <MyParameter> Add <T>(this List <MyParameter> myParameters, T entity) { if (entity == null) { return(null); } foreach (PropertyInfo propertyInfo in typeof(T).GetProperties()) { MyParameter myParameter = myParameters.Find(p => p.Name.Trim('@').Equals(propertyInfo.Name)); if (myParameter != null) { myParameter.Value = propertyInfo.GetValue(entity, null); } else { myParameters.Add("@" + propertyInfo.Name, ConvertHelper.GetDbType(propertyInfo.PropertyType), propertyInfo.GetValue(entity, null), null); } } return(myParameters); }
void UpdateEditor(ISupportControl supportControl) { if (supportControl == null) { return; } bool isChanged = false; var memberType = GetMemberType() ?? typeof(object); bool editObjectChanged = (_parameter != null) && (_parameter.Type != memberType); if (_propertyEditor.CurrentObject != null) { if ((_parameter == null) || (editObjectChanged) || supportControl.Control == null) { var application = _getApplicationAction.Invoke(); isChanged = true; _parameter = new MyParameter(memberType.Name, memberType) { Visible = true }; var paramList = new ParameterList { _parameter }; ParametersObject parametersObject = ParametersObject.CreateBoundObject(paramList); DetailView detailView = parametersObject.CreateDetailView(application.CreateObjectSpace(), application, true); detailView.ViewEditMode = GetViewEditMode(); _detailViewItems = ((PropertyEditor)detailView.Items[0]); _detailViewItems.CreateControl(); _detailViewItems.ControlValueChanged += detailViewItems_ControlValueChanged; } _parameter.CurrentValue = _propertyEditor.PropertyValue; } if ((isChanged || (supportControl.Control == null)) && (_detailViewItems != null)) { _detailViewItems.Refresh(); supportControl.Control = _findControl.Invoke(_detailViewItems); } }
public MyClass(MyParameter parameter) { }
void UpdateEditor(ISupportControl supportControl) { if (supportControl == null) return; bool isChanged = false; var memberType = GetMemberType() ?? typeof(object); bool editObjectChanged = (_parameter != null) && (_parameter.Type != memberType); if (_propertyEditor.CurrentObject != null) { if ((_parameter == null) || (editObjectChanged) || supportControl.Control == null) { var application = _getApplicationAction.Invoke(); isChanged = true; _parameter = new MyParameter(memberType.Name, memberType); var paramList = new ParameterList { _parameter }; ParametersObject parametersObject = ParametersObject.CreateBoundObject(paramList); DetailView detailView = parametersObject.CreateDetailView(application.CreateObjectSpace(), application, true); detailView.ViewEditMode = GetViewEditMode(); _detailViewItems = ((PropertyEditor)detailView.Items[0]); _detailViewItems.CreateControl(); _detailViewItems.ControlValueChanged += detailViewItems_ControlValueChanged; } _parameter.CurrentValue = _propertyEditor.PropertyValue; } if ((isChanged || (supportControl.Control == null)) && (_detailViewItems != null)) { _detailViewItems.Refresh(); supportControl.Control = _findControl.Invoke(_detailViewItems); } }
public MyClass(MyParameter p) { MyParameter = p; }
public string WithFromBodyAttribute([FromBody] MyParameter data) { return(string.Empty); }
public string WithoutAttribute(MyParameter data) { return(string.Empty); }
public override void UpdateParameter() { MyParameter.SetValue(get()); base.UpdateParameter(); }
internal ParameterNameMismatchException(MyParameter oldParameter, MyParameter newParameter) : base($"A mismatch on the API was found. The parameter on {oldParameter.GetShorthandParent()} was renamed from {oldParameter.Name} to {newParameter.Name}") { }
public string WithCustomFromBody2ParameterBinder([CustomFromBody2ParameterBinder] MyParameter data) { return(string.Empty); }
private void Compare(MyParameter existingParameter, MyParameter newParameter, List <SymbolMismatch> symbols) { Compare(existingParameter.Ordinal, newParameter.Ordinal, symbols, existingParameter, newParameter, MismatchReason.DefinitionChanged); Compare(existingParameter.Type, newParameter.Type, symbols); Compare(existingParameter.Name, newParameter.Name, symbols, existingParameter, newParameter, MismatchReason.ParameterNameChanged); }
public string WithoutAttribute(MyParameter data) { return string.Empty; }