private void WriteObjectProperty(IAttribute attribute, IEnvironmentHelper environment) { IRelation r = attribute.UsedInRelations[0]; IEntity related = r.Entity; if (r.Entity == attribute.Entity) { related = r.Entity2; } cw.WriteLine("private {0} {1};", environment.ToTypeName(related, true), environment.ToMemberName(attribute)); cw.BeginProperty(AccessLevel.Public, VirtualisationLevel.Virtual, environment.ToTypeName(related, true), attribute.Name); cw.BeginPropertyGet(); cw.WriteLine("return this.{0}.{1};", PropertyName_DomainObjectProxy, attribute.Name); cw.EndPropertyAccessor(); cw.BeginPropertySet(); cw.WriteLine("this.{0}.{1} = value;", PropertyName_DomainObjectProxy, attribute.Name); cw.EndPropertyAccessor(); cw.EndProperty(); }
public void DeclareMember(IAttribute attribute, string defaultValue, IEnvironmentHelper environment) { WriteLine("private {0} {1} = {2};", environment.ToTypeName(attribute, true), environment.ToMemberName(attribute), defaultValue); }
public void StandardProperty(AccessLevel accessLevel, VirtualisationLevel virtualisationLevel, IAttribute attribute, IEnvironmentHelper environment, string defaultValue, string propertyAttributes) { if (defaultValue == null || (defaultValue != null && defaultValue.Length == 0)) { DeclareMember(attribute, environment); } else { DeclareMember(attribute, defaultValue, environment); } if (!String.IsNullOrEmpty(propertyAttributes)) { WriteLine(propertyAttributes); } BeginProperty(accessLevel, virtualisationLevel, environment.ToTypeName(attribute, true), attribute.Name); WritePropertyGet(String.Format("return {0};", environment.ToMemberName(attribute))); if (!attribute.ReadOnly) { if (IsAttributeIsStringLimitedLength(attribute)) { WritePropertySet(String.Format("{0} = value != null && value.Length > {1} ? value.Substring(0, {1}) : value;", environment.ToMemberName(attribute), attribute.TypeDefinition.Length)); } else { WritePropertySet(String.Format("{0} = value;", environment.ToMemberName(attribute))); } } EndProperty(); }
public void DeclareMember(IAttribute attribute, IEnvironmentHelper environment) { WriteLine("private {0} {1};", environment.ToTypeName(attribute, true), environment.ToMemberName(attribute)); }