using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace DymWebForm { //meta [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] public sealed class DWFMetaAttribute : Attribute { public Type Type { get; private set; } public DWFMetaAttribute(Type type) { Type = type; } } //db [AttributeUsage(AttributeTargets.Property, Inherited = true, AllowMultiple = false)] public sealed class DWFIgnoreAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property, Inherited = true, AllowMultiple = false)] public sealed class DWFPKAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property, Inherited = true, AllowMultiple = false)] public sealed class DWFAllowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property, Inherited = true, AllowMultiple = false)] public sealed class DWFFKDisplayAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property, Inherited = true, AllowMultiple = false)] public sealed class DWFFKAttribute : Attribute { public Type ParentType { get; private set; } public DWFFKAttribute(Type parentType) { this.ParentType = parentType; } } //form uis [AttributeUsage(AttributeTargets.Property, Inherited = true, AllowMultiple = false)] public sealed class DWFDisplayOrderAttribute : Attribute { public int DisplayOrder { get; private set; } public DWFDisplayOrderAttribute(int displayOrder) { this.DisplayOrder = displayOrder; } } //defalut values [AttributeUsage(AttributeTargets.Property, Inherited = true, AllowMultiple = false)] public abstract class DWFDefaultValueGeneratorAttribute : Attribute { public abstract object GenerateValue(); } [AttributeUsage(AttributeTargets.Property, Inherited = true, AllowMultiple = false)] public class DWFDefaultValueDateTimeNowAttribute : DWFDefaultValueGeneratorAttribute { public override object GenerateValue() { return DateTime.Now; } } [AttributeUsage(AttributeTargets.Property, Inherited = true, AllowMultiple = false)] public class DWFDefaultValueBoolAttribute : DWFDefaultValueGeneratorAttribute { private bool m_value; public override object GenerateValue() { return m_value; } public DWFDefaultValueBoolAttribute(bool value) { m_value = value; } } //validations [AttributeUsage(AttributeTargets.Property, Inherited = true, AllowMultiple = false)] public class DWFValidationTypeAttribute : Attribute { internal Type ValidationType { get; private set; } public DWFValidationTypeAttribute(Type validationType) { ValidationType = validationType; } } }