public ComputedPropertyInfo(NamingConventions conventions, TypeInfo owner, string name,
		                            string type, bool cached, IEnumerable<string> dependsOn,
		                            string formula)
			: base(conventions, owner, name, type, false, false)
		{
			Cached = cached;
			DependsOn.AddRange(dependsOn);
			Formula = (formula == "" ? null : formula);

			Getter = new MethodInfo(GetGetterName(), TypeName);

			Setter = null;
			LazyInitializer = null;
			validator = null;

			if (Cached)
			{
				FieldName = FieldName + "Cache";
				ValidFieldName = FieldName + "Valid";
				Cacher = new MethodInfo(GetCacherName(), TypeName);
				Invalidate = new MethodInfo(GetInvalidateName());
			}
			else
			{
				FieldName = null;
				ValidFieldName = null;
				Cacher = Getter;
				Invalidate = null;
			}
		}
示例#2
0
		public virtual void MakeImmutable()
		{
			FieldName = Name;
			Getter = null;
			Setter = null;
			LazyInitializer = null;
		}
示例#3
0
		public PropertyInfo(NamingConventions conventions, TypeInfo owner, string name, string type,
		                    bool required, bool lazy)
			: base(conventions, name, type)
		{
			Owner = owner;
			Required = required;
			Lazy = lazy;

			string getter = GetGetterName();
			if (getter != null)
				Getter = new MethodInfo(getter, TypeName);

			string setter = GetSetterName();
			if (setter != null)
				Setter = new MethodInfo(setter, "bool", TypeName);

			string withSetter = GetWithSetterName();
			if (withSetter != null)
				WithSetter = new MethodInfo(withSetter, owner.Name, TypeName);

			string lazyIntializer = GetLazyInitializerName();
			if (lazyIntializer != null)
				LazyInitializer = new MethodInfo(lazyIntializer);

			string validatorName = GetValidatorName();
			if (validatorName != null)
				validator = new MethodInfo(validatorName, "void", TypeName);
		}