void Check(string checkName, GetMethod getMethod, SetMethod setMethod) { string s = "Check name ; " + checkName + "\n"; try { setMethod(); s += "Set succeeded\n"; } catch (Exception e) { s += "Set through exception :\n\t" + e.Message + "\n"; } try { s += "Value set is : " + getMethod().ToString() + "\n"; s += "Get succeeded\n"; } catch (Exception e) { s += "Get through exception : \n\t" + e.Message; } MessageRouter.MessageBox(new List <string> { s }); }
public void CreatesCorrectPolicy(string method) { var basePolicy = new SetMethod(new HttpMethod(method)); var xml = basePolicy.GetXml().ToString(); xml.Should().Be($"<set-method>{method}</set-method>"); }
public void SetTargetValue(object value) { if (Target != null && SetMethod != null) { SetMethod.Invoke(Target, new object[] { value }); } }
/// <summary> /// Abstract base class for control parameters, managed by <see cref="XmppControl"/>. /// </summary> /// <param name="Name">Parameter Name</param> /// <param name="GetMethod">Method for getting the current value of the parameter.</param> /// <param name="SetMethod">Method for setting a new value for the parameter.</param> /// <param name="Title">Parameter title.</param> /// <param name="Description">Parameter description.</param> public ControlParameter(string Name, GetMethod <T> GetMethod, SetMethod <T> SetMethod, string Title, string Description) { this.name = Name; this.getMethod = GetMethod; this.setMethod = SetMethod; this.title = Title; this.description = Description; }
public override int GetHashCode() { unchecked { return(((GetMethod != null ? GetMethod.GetHashCode() : 0) * 397) ^ (SetMethod != null ? SetMethod.GetHashCode() : 0)); } }
static MethodRef() { if (methodNames.TryGetValue(typeof(T), out string methodName)) { Method = (SetMethod)Delegate.CreateDelegate(typeof(SetMethod), typeof(MaterialPropertyBlock).GetMethod(methodName, arguments)); } }
static MethodRef() { if (methodNames.TryGetValue(typeof(T), out string methodName)) { Method = (SetMethod)Delegate.CreateDelegate(typeof(SetMethod), typeof(CommandBuffer).GetMethod(methodName, arguments)); } }
/// <summary> /// Calls the set method of the android.os.SystemProperties class /// </summary> /// <param name="PropertyName">The name of the system property to get the value for</param> /// <param name="PropertyValue">The value to set for the system property</param> /// <returns>The previous value of the specified property or null if it does not exists</returns> public static string SetProp(string PropertyName, string PropertyValue) { // Invoking a static method, first parameter is null var r = SetMethod.Invoke(null, new Java.Lang.String(PropertyName), new Java.Lang.String(PropertyValue)); return(r.ToString()); }
/// <summary> /// Notifies the specified value. /// </summary> /// <param name="value">The value.</param> public void Notify(object value) { if (PropertyOwner != null && SetMethod != null) { var parameters = new object[1]; parameters[0] = value; SetMethod.Invoke(PropertyOwner, parameters); } InternalValue = value; }
/// <summary> /// Better use JsonPatchManager for convenience. /// </summary> internal JsonPatch(JsonPatchOperation operation, string path) { this.Operation = operation; this.Path = path; _setMethod = SetMethod.None; if (operation == JsonPatchOperation.Remove) { this.Data = "null"; } }
/// <summary> /// Better use JsonPatchManager for convenience. /// </summary> internal JsonPatch(string operation, string path) { JsonPatchOperation op; if (!Enum.TryParse<JsonPatchOperation>(operation, true, out op)) { throw new InvalidCastException(string.Format("Unrecognized JSON patch operation '{0}'.", operation)); } this.Operation = op; this.Path = path; _setMethod = SetMethod.None; }
/// <summary> /// When overridden in a derived class, sets the property value for a specified object that has the specified binding, index, and culture-specific information. /// </summary> /// <param name="obj">The object whose property value will be set. </param><param name="value">The new property value. </param><param name="invokeAttr">A bitwise combination of the following enumeration members that specify the invocation attribute: InvokeMethod, CreateInstance, Static, GetField, SetField, GetProperty, or SetProperty. You must specify a suitable invocation attribute. For example, to invoke a static member, set the Static flag. </param><param name="binder">An object that enables the binding, coercion of argument types, invocation of members, and retrieval of <see cref="T:System.Reflection.MemberInfo"/> objects through reflection. If <paramref name="binder"/> is null, the default binder is used. </param><param name="index">Optional index values for indexed properties. This value should be null for non-indexed properties. </param><param name="culture">The culture for which the resource is to be localized. If the resource is not localized for this culture, the <see cref="P:System.Globalization.CultureInfo.Parent"/> property will be called successively in search of a match. If this value is null, the culture-specific information is obtained from the <see cref="P:System.Globalization.CultureInfo.CurrentUICulture"/> property. </param><exception cref="T:System.ArgumentException">The <paramref name="index"/> array does not contain the type of arguments needed.-or- The property's set accessor is not found. </exception><exception cref="T:System.Reflection.TargetException">The object does not match the target type, or a property is an instance property but <paramref name="obj"/> is null. </exception><exception cref="T:System.Reflection.TargetParameterCountException">The number of parameters in <paramref name="index"/> does not match the number of parameters the indexed property takes. </exception><exception cref="T:System.MethodAccessException">There was an illegal attempt to access a private or protected method inside a class. </exception><exception cref="T:System.Reflection.TargetInvocationException">An error occurred while setting the property value. For example, an index value specified for an indexed property is out of range. The <see cref="P:System.Exception.InnerException"/> property indicates the reason for the error.</exception> public void SetValue(object obj, object value, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture) { var args = new object[1 + (index != null ? index.Length : 0)]; args[0] = value; for (var i = 1; i < args.Length; i++) { args[i] = index[i - 1]; } SetMethod.Invoke(obj, invokeAttr, binder, args, culture); }
/// <summary> /// Better use JsonPatchManager for convenience. /// </summary> internal JsonPatch(string operation, string path) { JsonPatchOperation op; if (!Enum.TryParse <JsonPatchOperation>(operation, true, out op)) { throw new InvalidCastException(string.Format("Unrecognized JSON patch operation '{0}'.", operation)); } this.Operation = op; this.Path = path; _setMethod = SetMethod.None; }
private void CreateDelegates(object targetInstance, PropertyInfo property) { if (property.PropertyType != typeof(TValue)) { throw new InvalidBindingTypeException(typeof(TValue).DeclaringType, property.Name); } var getMethod = property.GetGetMethod(); var setMethod = property.GetSetMethod(); getter = (GetMethod)getMethod.CreateDelegate(typeof(GetMethod), targetInstance); setter = (SetMethod)setMethod.CreateDelegate(typeof(SetMethod), targetInstance); }
protected override void ChildSpecificAccept(IDefinitionVisitor visitor) { ArgumentUtility.CheckNotNull("visitor", visitor); visitor.Visit(this); if (GetMethod != null) { GetMethod.Accept(visitor); } if (SetMethod != null) { SetMethod.Accept(visitor); } }
public SetComparisons() { _property = typeof(SetComparisons).GetProperty(nameof(SomeProperty), BindingFlags.Public | BindingFlags.Instance); _field = typeof(SetComparisons).GetField(nameof(SomeField), BindingFlags.Public | BindingFlags.Instance); _propertySet = _property.SetMethod; _propSetExpressions = PropCreateSetViaExpressions(); _propSetIL = PropCreateSetViaIL(); _propSetSwissIL = PropCreateSetViaSwissIL(); _fieldSetSwissIL = FieldCreateSetViaSwissIL(); _propSetSwissIL(this, string.Empty); _fieldSetSwissIL(this, string.Empty); }
public CustomPropertyEmitter ImplementWithBackingField(FieldReference backingField) { ArgumentUtility.CheckNotNull("backingField", backingField); if (GetMethod != null) { GetMethod.AddStatement(new ReturnStatement(backingField)); } if (SetMethod != null) { SetMethod.AddStatement( new AssignStatement(backingField, SetMethod.ArgumentReferences[IndexParameters.Length].ToExpression())); SetMethod.ImplementByReturningVoid(); } return(this); }
/// <summary> /// When overridden in a derived class, sets the property value for a specified object that has the specified binding, index, and culture-specific information. /// </summary> /// <param name="obj">The object whose property value will be set. </param><param name="value">The new property value. </param><param name="invokeAttr">A bitwise combination of the following enumeration members that specify the invocation attribute: InvokeMethod, CreateInstance, Static, GetField, SetField, GetProperty, or SetProperty. You must specify a suitable invocation attribute. For example, to invoke a static member, set the Static flag. </param><param name="binder">An object that enables the binding, coercion of argument types, invocation of members, and retrieval of <see cref="T:System.Reflection.MemberInfo"/> objects through reflection. If <paramref name="binder"/> is null, the default binder is used. </param><param name="index">Optional index values for indexed properties. This value should be null for non-indexed properties. </param><param name="culture">The culture for which the resource is to be localized. If the resource is not localized for this culture, the <see cref="P:System.Globalization.CultureInfo.Parent"/> property will be called successively in search of a match. If this value is null, the culture-specific information is obtained from the <see cref="P:System.Globalization.CultureInfo.CurrentUICulture"/> property. </param><exception cref="T:System.ArgumentException">The <paramref name="index"/> array does not contain the type of arguments needed.-or- The property's set accessor is not found. </exception><exception cref="T:System.Reflection.TargetException">The object does not match the target type, or a property is an instance property but <paramref name="obj"/> is null. </exception><exception cref="T:System.Reflection.TargetParameterCountException">The number of parameters in <paramref name="index"/> does not match the number of parameters the indexed property takes. </exception><exception cref="T:System.MethodAccessException">There was an illegal attempt to access a private or protected method inside a class. </exception><exception cref="T:System.Reflection.TargetInvocationException">An error occurred while setting the property value. For example, an index value specified for an indexed property is out of range. The <see cref="P:System.Exception.InnerException"/> property indicates the reason for the error.</exception> public void SetValue(object obj, object value, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture) { if (SetMethod == null) { throw new InvalidOperationException("Property '" + DeclaringType.FullName + "." + Name + "' does not have a setter."); } var args = Jsni.@new(Jsni.reference("Array"), (1 + (index != null ? index.Length : 0)).As <JsObject>()).As <JsArray>(); // new object[1 + (index != null ? index.Length : 0)]; args[0] = value.As <JsObject>(); for (var i = 1; i < args.length; i++) { args[i] = index[i - 1].As <JsObject>(); } SetMethod.Invoke(obj, invokeAttr, binder, args.As <object[]>(), culture); }
internal override void AddOverride(MemberDefinitionBase member) { ArgumentUtility.CheckNotNull("member", member); var overrider = member as PropertyDefinition; if (overrider == null) { string message = string.Format("Member {0} cannot override property {1} - it is not a property.", member.FullName, FullName); throw new ArgumentException(message); } Overrides.Add(overrider); if (GetMethod != null && overrider.GetMethod != null) { GetMethod.AddOverride(overrider.GetMethod); } if (SetMethod != null && overrider.SetMethod != null) { SetMethod.AddOverride(overrider.SetMethod); } }
public DefaultPropertyDefinition(TypeDefinition typeDef, string name, GetMethod getter, SetMethod setter, string declaringTypeName, MemberAccessibility memberAccessibility, MemberType memberType) { if (typeDef == null) throw new ArgumentNullException("typeDef"); if (name == null) throw new ArgumentNullException("name"); if (declaringTypeName == null) throw new ArgumentNullException("declaringTypeName"); Name = name; FullName = declaringTypeName + "." + name; this.getter = getter; this.setter = setter; this.memberAccessibility = memberAccessibility; this.memberType = memberType; TypeDef = typeDef; SerializedName = name.IsAutoPropertyBackingField() ? name.AutoPropertyName() : name; }
/// <summary> /// Class handling a color-valued control parameter. /// </summary> /// <param name="Name">Parameter Name</param> /// <param name="GetMethod">Method for getting the current value of the parameter.</param> /// <param name="SetMethod">Method for setting a new value for the parameter.</param> /// <param name="Title">Parameter title.</param> /// <param name="Description">Parameter description.</param> public ColorControlParameter(string Name, GetMethod <Color> GetMethod, SetMethod <Color> SetMethod, string Title, string Description) : base(Name, GetMethod, SetMethod, Title, Description) { }
public virtual void ProcessModelFinalizing( IConventionModelBuilder modelBuilder, IConventionContext <IConventionModelBuilder> context) { if (_options?.UseProxies == true) { foreach (var entityType in modelBuilder.Metadata.GetEntityTypes()) { var clrType = entityType.ClrType; if (!clrType.IsAbstract) { if (clrType.IsSealed) { throw new InvalidOperationException(ProxiesStrings.ItsASeal(entityType.DisplayName())); } var proxyType = _proxyFactory.CreateProxyType(_options, (IEntityType)entityType); // WARNING: This code is EF internal; it should not be copied. See #10789 #14554 #pragma warning disable EF1001 // Internal EF Core API usage. var binding = (InstantiationBinding?)entityType[CoreAnnotationNames.ConstructorBinding]; if (binding == null) { _directBindingConvention.ProcessModelFinalizing(modelBuilder, context); } binding = (InstantiationBinding)entityType[CoreAnnotationNames.ConstructorBinding] !; UpdateConstructorBindings(CoreAnnotationNames.ConstructorBinding, binding); binding = (InstantiationBinding?)entityType[CoreAnnotationNames.ServiceOnlyConstructorBinding]; if (binding != null) { UpdateConstructorBindings(CoreAnnotationNames.ServiceOnlyConstructorBinding, binding); } #pragma warning restore EF1001 // Internal EF Core API usage. foreach (var navigationBase in entityType.GetDeclaredNavigations() .Concat <IConventionNavigationBase>(entityType.GetDeclaredSkipNavigations())) { if (navigationBase.PropertyInfo == null) { throw new InvalidOperationException( ProxiesStrings.FieldProperty(navigationBase.Name, entityType.DisplayName())); } if (_options.UseChangeTrackingProxies && navigationBase.PropertyInfo.SetMethod?.IsReallyVirtual() == false) { throw new InvalidOperationException( ProxiesStrings.NonVirtualProperty(navigationBase.Name, entityType.DisplayName())); } if (_options.UseLazyLoadingProxies) { if (!navigationBase.PropertyInfo.GetMethod.IsReallyVirtual() && (!(navigationBase is INavigation navigation && navigation.ForeignKey.IsOwnership))) { throw new InvalidOperationException( ProxiesStrings.NonVirtualProperty(navigationBase.Name, entityType.DisplayName())); } navigationBase.SetPropertyAccessMode(PropertyAccessMode.Field); } } if (_options.UseChangeTrackingProxies) { var indexerChecked = false; foreach (var property in entityType.GetDeclaredProperties() .Where(p => !p.IsShadowProperty())) { if (property.IsIndexerProperty()) { if (!indexerChecked) { indexerChecked = true; if (!property.PropertyInfo !.SetMethod.IsReallyVirtual()) { if (clrType.IsGenericType && clrType.GetGenericTypeDefinition() == typeof(Dictionary <,>) && clrType.GenericTypeArguments[0] == typeof(string)) { if (entityType.GetProperties().Any(p => !p.IsPrimaryKey())) { throw new InvalidOperationException( ProxiesStrings.DictionaryCannotBeProxied( clrType.ShortDisplayName(), entityType.DisplayName(), typeof(IDictionary <,>).MakeGenericType(clrType.GenericTypeArguments) .ShortDisplayName())); } } else { throw new InvalidOperationException( ProxiesStrings.NonVirtualIndexerProperty(entityType.DisplayName())); } } } } else { if (property.PropertyInfo == null) { throw new InvalidOperationException( ProxiesStrings.FieldProperty(property.Name, entityType.DisplayName())); } if (property.PropertyInfo.SetMethod?.IsReallyVirtual() == false) { throw new InvalidOperationException( ProxiesStrings.NonVirtualProperty(property.Name, entityType.DisplayName())); } } } } void UpdateConstructorBindings(string bindingAnnotationName, InstantiationBinding binding) { if (_options.UseLazyLoadingProxies) { foreach (var conflictingProperty in entityType.GetDerivedTypes() .SelectMany(e => e.GetDeclaredServiceProperties().Where(p => p.ClrType == typeof(ILazyLoader))) .ToList()) { conflictingProperty.DeclaringEntityType.RemoveServiceProperty(conflictingProperty.Name); } var serviceProperty = entityType.GetServiceProperties() .FirstOrDefault(e => e.ClrType == typeof(ILazyLoader)); if (serviceProperty == null) { serviceProperty = entityType.AddServiceProperty(_lazyLoaderProperty); serviceProperty.SetParameterBinding( (ServiceParameterBinding) new LazyLoaderParameterBindingFactory( _lazyLoaderParameterBindingFactoryDependencies) .Bind( entityType, typeof(ILazyLoader), nameof(IProxyLazyLoader.LazyLoader))); } entityType.SetAnnotation( bindingAnnotationName, new FactoryMethodBinding( _proxyFactory, _createLazyLoadingProxyMethod, new List <ParameterBinding> { new ContextParameterBinding(typeof(DbContext)), new EntityTypeParameterBinding(), new DependencyInjectionParameterBinding( typeof(ILazyLoader), typeof(ILazyLoader), (IPropertyBase)serviceProperty), new ObjectArrayParameterBinding(binding.ParameterBindings) }, proxyType)); } else { entityType.SetAnnotation( bindingAnnotationName, new FactoryMethodBinding( _proxyFactory, _createProxyMethod, new List <ParameterBinding> { new ContextParameterBinding(typeof(DbContext)), new EntityTypeParameterBinding(), new ObjectArrayParameterBinding(binding.ParameterBindings) }, proxyType)); } } } } } }
public static void Set(object instan, string name, object value) { string t = instan.GetType().Name; SetMethod(instan.GetType())(instan, name.ToLower(), value); }
public override bool Define () { if (!base.Define ()) return false; flags |= MethodAttributes.HideBySig | MethodAttributes.SpecialName; bool auto = AccessorFirst.Block == null && (AccessorSecond == null || AccessorSecond.Block == null) && (ModFlags & (Modifiers.ABSTRACT | Modifiers.EXTERN)) == 0; if (Initializer != null) { if (!auto) Report.Error (8050, Location, "`{0}': Only auto-implemented properties can have initializers", GetSignatureForError ()); if (IsInterface) Report.Error (8053, Location, "`{0}': Properties inside interfaces cannot have initializers", GetSignatureForError ()); if (Compiler.Settings.Version < LanguageVersion.V_6) Report.FeatureIsNotAvailable (Compiler, Location, "auto-implemented property initializer"); } if (auto) { if (Get == null) { Report.Error (8052, Location, "Auto-implemented property `{0}' must have get accessor", GetSignatureForError ()); return false; } if (Initializer == null && AccessorSecond == null) { Report.Error (8051, Location, "Auto-implemented property `{0}' must have set accessor or initializer", GetSignatureForError ()); } if (Compiler.Settings.Version < LanguageVersion.V_3 && Initializer == null) Report.FeatureIsNotAvailable (Compiler, Location, "auto-implemented properties"); CreateAutomaticProperty (); } if (!DefineAccessors ()) return false; if (AccessorSecond == null) { PropertyMethod pm; if (AccessorFirst is GetMethod) pm = new SetMethod (this, 0, ParametersCompiled.EmptyReadOnlyParameters, null, Location); else pm = new GetMethod (this, 0, null, Location); Parent.AddNameToContainer (pm, pm.MemberName.Basename); } if (!CheckBase ()) return false; DefineBuilders (MemberKind.Property, ParametersCompiled.EmptyReadOnlyParameters); return true; }
public Property(DeclSpace parent, FullNamedExpression type, Modifiers mod, MemberName name, Attributes attrs, Accessor get_block, Accessor set_block, bool define_set_first, Block current_block) : base(parent, type, mod, parent.PartialContainer.Kind == MemberKind.Interface ? AllowedInterfaceModifiers : AllowedModifiers, name, attrs, define_set_first) { if (get_block == null) Get = new GetMethod (this); else Get = new GetMethod (this, get_block); if (set_block == null) Set = new SetMethod (this); else Set = new SetMethod (this, set_block); if (!IsInterface && (mod & (Modifiers.ABSTRACT | Modifiers.EXTERN)) == 0 && get_block != null && get_block.Block == null && set_block != null && set_block.Block == null) { if (RootContext.Version <= LanguageVersion.ISO_2) Report.FeatureIsNotAvailable (Location, "automatically implemented properties"); Get.ModFlags |= Modifiers.COMPILER_GENERATED; Set.ModFlags |= Modifiers.COMPILER_GENERATED; } }
/// <summary> /// Class handling a int-valued control parameter. /// </summary> /// <param name="Name">Parameter Name</param> /// <param name="GetMethod">Method for getting the current value of the parameter.</param> /// <param name="SetMethod">Method for setting a new value for the parameter.</param> /// <param name="Title">Parameter title.</param> /// <param name="Description">Parameter description.</param> /// <param name="Min">Smallest value allowed.</param> /// <param name="Max">Largest value allowed.</param> public Int32ControlParameter(string Name, GetMethod <int> GetMethod, SetMethod <int> SetMethod, string Title, string Description, int Min, int Max) : base(Name, GetMethod, SetMethod, Title, Description) { this.min = Min; this.max = Max; }
/// <summary> /// Class handling a string-valued control parameter. /// </summary> /// <param name="Name">Parameter Name</param> /// <param name="GetMethod">Method for getting the current value of the parameter.</param> /// <param name="SetMethod">Method for setting a new value for the parameter.</param> /// <param name="RegEx">A regular expression used for validation.</param> /// <param name="Title">Parameter title.</param> /// <param name="Description">Parameter description.</param> public StringControlParameter(string Name, GetMethod <string> GetMethod, SetMethod <string> SetMethod, string RegEx, string Title, string Description) : base(Name, GetMethod, SetMethod, Title, Description) { this.regex = RegEx; }
/// <summary> /// Class handling a boolean-valued control parameter. /// </summary> /// <param name="Name">Parameter Name</param> /// <param name="GetMethod">Method for getting the current value of the parameter.</param> /// <param name="SetMethod">Method for setting a new value for the parameter.</param> /// <param name="Title">Parameter title.</param> /// <param name="Description">Parameter description.</param> public BooleanControlParameter(string Name, GetMethod <bool> GetMethod, SetMethod <bool> SetMethod, string Title, string Description) : base(Name, GetMethod, SetMethod, Title, Description) { }
public static IQueryable Query( this DbContext context, Type entityType) => (IQueryable)SetMethod.MakeGenericMethod(entityType).Invoke(context, null);
/// <summary> /// Class handling a double-valued control parameter. /// </summary> /// <param name="Name">Parameter Name</param> /// <param name="GetMethod">Method for getting the current value of the parameter.</param> /// <param name="SetMethod">Method for setting a new value for the parameter.</param> /// <param name="Title">Parameter title.</param> /// <param name="Description">Parameter description.</param> /// <param name="Min">Smallest value allowed.</param> /// <param name="Max">Largest value allowed.</param> public DoubleControlParameter(string Name, GetMethod <double> GetMethod, SetMethod <double> SetMethod, string Title, string Description, double Min, double Max) : base(Name, GetMethod, SetMethod, Title, Description) { this.min = Min; this.max = Max; }
/// <summary> /// Class handling a long-valued control parameter. /// </summary> /// <param name="Name">Parameter Name</param> /// <param name="GetMethod">Method for getting the current value of the parameter.</param> /// <param name="SetMethod">Method for setting a new value for the parameter.</param> /// <param name="Title">Parameter title.</param> /// <param name="Description">Parameter description.</param> /// <param name="Min">Smallest value allowed.</param> /// <param name="Max">Largest value allowed.</param> public Int64ControlParameter(string Name, GetMethod <long> GetMethod, SetMethod <long> SetMethod, string Title, string Description, long Min, long Max) : base(Name, GetMethod, SetMethod, Title, Description) { this.min = Min; this.max = Max; }
/// <summary> /// Class handling a time-valued control parameter. /// </summary> /// <param name="Name">Parameter Name</param> /// <param name="GetMethod">Method for getting the current value of the parameter.</param> /// <param name="SetMethod">Method for setting a new value for the parameter.</param> /// <param name="Title">Parameter title.</param> /// <param name="Description">Parameter description.</param> /// <param name="Min">Smallest value allowed.</param> /// <param name="Max">Largest value allowed.</param> public TimeControlParameter(string Name, GetMethod <TimeSpan> GetMethod, SetMethod <TimeSpan> SetMethod, string Title, string Description, TimeSpan Min, TimeSpan Max) : base(Name, GetMethod, SetMethod, Title, Description) { this.min = Min; this.max = Max; }
public override bool Define () { if (!base.Define ()) return false; flags |= MethodAttributes.HideBySig | MethodAttributes.SpecialName; if (!IsInterface && (ModFlags & (Modifiers.ABSTRACT | Modifiers.EXTERN)) == 0 && AccessorSecond != null && Get.Block == null && Set.Block == null) { if (Compiler.Settings.Version <= LanguageVersion.ISO_2) Report.FeatureIsNotAvailable (Compiler, Location, "automatically implemented properties"); Get.ModFlags |= Modifiers.COMPILER_GENERATED; Set.ModFlags |= Modifiers.COMPILER_GENERATED; CreateAutomaticProperty (); } if (!DefineAccessors ()) return false; if (AccessorSecond == null) { PropertyMethod pm; if (AccessorFirst is GetMethod) pm = new SetMethod (this, 0, ParametersCompiled.EmptyReadOnlyParameters, null, Location); else pm = new GetMethod (this, 0, null, Location); Parent.AddNameToContainer (pm, pm.MemberName.Basename); } if (!CheckBase ()) return false; DefineBuilders (MemberKind.Property, ParametersCompiled.EmptyReadOnlyParameters); return true; }
///// <summary> ///// 获取数据库值表达 ///// </summary> ///// <param name="entity"></param> ///// <returns></returns> //public string GetDbValueStatement(object entity) //{ // object value = GetMethod.Invoke(entity, null); // return DatabaseEngine.GetDbValueStatement(value); //} /// <summary> /// 赋值 /// </summary> /// <param name="entity"></param> /// <param name="value"></param> public void SetValue(object entity, object value) { SetMethod.Invoke(entity, new object[] { value }); }
/// <summary> /// Class handling a Duration-valued control parameter. /// </summary> /// <param name="Name">Parameter Name</param> /// <param name="GetMethod">Method for getting the current value of the parameter.</param> /// <param name="SetMethod">Method for setting a new value for the parameter.</param> /// <param name="Title">Parameter title.</param> /// <param name="Description">Parameter description.</param> /// <param name="Min">Smallest value allowed, can be null if no smallest value.</param> /// <param name="Max">Largest value allowed, can be null if no largest value.</param> public DurationControlParameter(string Name, GetMethod <Duration> GetMethod, SetMethod <Duration> SetMethod, string Title, string Description, Duration Min, Duration Max) : base(Name, GetMethod, SetMethod, Title, Description) { this.min = Min; this.max = Max; }