public override void Generate() { #line 37 "P:\zetbox\Zetbox.DalProvider.EF.Generator\Templates\Properties\CompoundObjectPropertyTemplate.cst" this.WriteObjects(" // BEGIN ", this.GetType(), "\r\n"); this.WriteObjects(" // implement the user-visible interface\r\n"); this.WriteObjects(" public ", coType, " ", propName, "\r\n"); this.WriteObjects(" {\r\n"); this.WriteObjects(" get { return ", backingPropertyName, "; }\r\n"); this.WriteObjects(" set { ", backingPropertyName, " = (", coImplementationType, ")value; }\r\n"); this.WriteObjects(" }\r\n"); this.WriteObjects("\r\n"); this.WriteObjects(" /// <summary>backing store for ", UglyXmlEncode(propName), "</summary>\r\n"); #line 46 "P:\zetbox\Zetbox.DalProvider.EF.Generator\Templates\Properties\CompoundObjectPropertyTemplate.cst" EfScalarPropHelper.ApplyBackingStoreDefinition(this, coImplementationType, backingStoreName, backingPropertyName); #line 47 "P:\zetbox\Zetbox.DalProvider.EF.Generator\Templates\Properties\CompoundObjectPropertyTemplate.cst" this.WriteObjects("\r\n"); this.WriteObjects(" /// <summary>backing property for ", UglyXmlEncode(propName), ", takes care of attaching/detaching the values, mapped via EF</summary>\r\n"); this.WriteObjects(" [XmlIgnore()]\r\n"); this.WriteObjects(" [EdmComplexProperty()]\r\n"); this.WriteObjects(" public ", coImplementationType, " ", backingPropertyName, "\r\n"); this.WriteObjects(" {\r\n"); this.WriteObjects(" get \r\n"); this.WriteObjects(" { \r\n"); this.WriteObjects(" return ", backingStoreName, "; \r\n"); this.WriteObjects(" }\r\n"); this.WriteObjects(" set\r\n"); this.WriteObjects(" {\r\n"); this.WriteObjects(" if (((IPersistenceObject)this).IsReadonly) throw new ReadOnlyObjectException();\r\n"); this.WriteObjects(" if (value == null)\r\n"); this.WriteObjects(" throw new ArgumentNullException(\"value\");\r\n"); this.WriteObjects(" if (!object.Equals(", backingStoreName, ", value))\r\n"); this.WriteObjects(" {\r\n"); this.WriteObjects(" var __oldValue = ", backingStoreName, ";\r\n"); this.WriteObjects(" var __newValue = value;\r\n"); this.WriteObjects("\r\n"); this.WriteObjects(" NotifyPropertyChanging(\"", propName, "\", __oldValue, __newValue);\r\n"); this.WriteObjects("\r\n"); this.WriteObjects(" if (", backingStoreName, " != null)\r\n"); this.WriteObjects(" {\r\n"); this.WriteObjects(" ", backingStoreName, ".DetachFromObject(this, \"", propName, "\");\r\n"); this.WriteObjects(" }\r\n"); this.WriteObjects(" __newValue = (", coImplementationType, ")__newValue.Clone();\r\n"); this.WriteObjects(" ", backingStoreName, " = __newValue;\r\n"); this.WriteObjects(" ", backingStoreName, ".AttachToObject(this, \"", propName, "\");\r\n"); this.WriteObjects("\r\n"); this.WriteObjects(" NotifyPropertyChanged(\"", propName, "\", __oldValue, __newValue);\r\n"); this.WriteObjects(" }\r\n"); this.WriteObjects(" else\r\n"); this.WriteObjects(" {\r\n"); this.WriteObjects(" SetInitializedProperty(\"", propName, "\");\r\n"); this.WriteObjects(" }\r\n"); this.WriteObjects(" }\r\n"); this.WriteObjects(" }\r\n"); #line 86 "P:\zetbox\Zetbox.DalProvider.EF.Generator\Templates\Properties\CompoundObjectPropertyTemplate.cst" AddSerialization(serializationList, coType, propName, coImplementationType, backingPropertyName); #line 88 "P:\zetbox\Zetbox.DalProvider.EF.Generator\Templates\Properties\CompoundObjectPropertyTemplate.cst" this.WriteObjects(" // END ", this.GetType(), ""); }
protected override void ApplyBackingStoreDefinition() { EfScalarPropHelper.ApplyBackingStoreDefinition(this, type, backingName, name); }
protected override void ApplyAttributesTemplate() { base.ApplyAttributesTemplate(); EfScalarPropHelper.ApplyAttributesTemplate(this); }
public override void Generate() { #line 34 "P:\zetbox\Zetbox.DalProvider.EF.Generator\Templates\Properties\EnumerationPropertyTemplate.cst" string interfaceName = prop.ObjectClass.Name; string name = prop.Name; string efName = name + ImplementationPropertySuffix; string backingName = "_" + name; bool isNullable = prop.Constraints.OfType <NotNullableConstraint>().Count() == 0; string enumType = prop.GetElementTypeString(); string eventName = "On" + name; #line 45 "P:\zetbox\Zetbox.DalProvider.EF.Generator\Templates\Properties\EnumerationPropertyTemplate.cst" this.WriteObjects(" // ", this.GetType(), "\r\n"); this.WriteObjects(" // implement the user-visible interface\r\n"); this.WriteObjects(" public ", enumType, " ", name, "\r\n"); this.WriteObjects(" {\r\n"); this.WriteObjects(" get\r\n"); this.WriteObjects(" {\r\n"); #line 52 "P:\zetbox\Zetbox.DalProvider.EF.Generator\Templates\Properties\EnumerationPropertyTemplate.cst" if (callGetterSetterEvents) { #line 55 "P:\zetbox\Zetbox.DalProvider.EF.Generator\Templates\Properties\EnumerationPropertyTemplate.cst" this.WriteObjects(" var __value = ", backingName, ";\r\n"); this.WriteObjects(" if(", eventName, "_Getter != null)\r\n"); this.WriteObjects(" {\r\n"); this.WriteObjects(" var e = new PropertyGetterEventArgs<", enumType, ">(__value);\r\n"); this.WriteObjects(" ", eventName, "_Getter(this, e);\r\n"); this.WriteObjects(" __value = e.Result;\r\n"); this.WriteObjects(" }\r\n"); this.WriteObjects(" return __value;\r\n"); #line 64 "P:\zetbox\Zetbox.DalProvider.EF.Generator\Templates\Properties\EnumerationPropertyTemplate.cst" } else { #line 68 "P:\zetbox\Zetbox.DalProvider.EF.Generator\Templates\Properties\EnumerationPropertyTemplate.cst" this.WriteObjects(" return ", backingName, ";\r\n"); #line 70 "P:\zetbox\Zetbox.DalProvider.EF.Generator\Templates\Properties\EnumerationPropertyTemplate.cst" } #line 71 "P:\zetbox\Zetbox.DalProvider.EF.Generator\Templates\Properties\EnumerationPropertyTemplate.cst" this.WriteObjects(" }\r\n"); this.WriteObjects(" set\r\n"); this.WriteObjects(" {\r\n"); this.WriteObjects(" if (((IPersistenceObject)this).IsReadonly) throw new ReadOnlyObjectException();\r\n"); this.WriteObjects(" if (", backingName, " != value)\r\n"); this.WriteObjects(" {\r\n"); this.WriteObjects(" var __oldValue = ", backingName, ";\r\n"); this.WriteObjects(" var __newValue = value;\r\n"); #line 80 "P:\zetbox\Zetbox.DalProvider.EF.Generator\Templates\Properties\EnumerationPropertyTemplate.cst" if (callGetterSetterEvents) { #line 83 "P:\zetbox\Zetbox.DalProvider.EF.Generator\Templates\Properties\EnumerationPropertyTemplate.cst" this.WriteObjects(" if(", eventName, "_PreSetter != null)\r\n"); this.WriteObjects(" {\r\n"); this.WriteObjects(" var e = new PropertyPreSetterEventArgs<", enumType, ">(__oldValue, __newValue);\r\n"); this.WriteObjects(" ", eventName, "_PreSetter(this, e);\r\n"); this.WriteObjects(" __newValue = e.Result;\r\n"); this.WriteObjects(" }\r\n"); #line 90 "P:\zetbox\Zetbox.DalProvider.EF.Generator\Templates\Properties\EnumerationPropertyTemplate.cst" } #line 91 "P:\zetbox\Zetbox.DalProvider.EF.Generator\Templates\Properties\EnumerationPropertyTemplate.cst" this.WriteObjects(" \r\n"); this.WriteObjects(" NotifyPropertyChanging(\"", name, "\", __oldValue, __newValue);\r\n"); this.WriteObjects(" ", backingName, " = value;\r\n"); this.WriteObjects(" NotifyPropertyChanged(\"", name, "\", __oldValue, __newValue);\r\n"); #line 96 "P:\zetbox\Zetbox.DalProvider.EF.Generator\Templates\Properties\EnumerationPropertyTemplate.cst" if (callGetterSetterEvents) { #line 99 "P:\zetbox\Zetbox.DalProvider.EF.Generator\Templates\Properties\EnumerationPropertyTemplate.cst" this.WriteObjects(" if(", eventName, "_PostSetter != null)\r\n"); this.WriteObjects(" {\r\n"); this.WriteObjects(" var e = new PropertyPostSetterEventArgs<", enumType, ">(__oldValue, __newValue);\r\n"); this.WriteObjects(" ", eventName, "_PostSetter(this, e);\r\n"); this.WriteObjects(" }\r\n"); #line 105 "P:\zetbox\Zetbox.DalProvider.EF.Generator\Templates\Properties\EnumerationPropertyTemplate.cst" } #line 106 "P:\zetbox\Zetbox.DalProvider.EF.Generator\Templates\Properties\EnumerationPropertyTemplate.cst" this.WriteObjects(" \r\n"); this.WriteObjects(" }\r\n"); this.WriteObjects(" }\r\n"); this.WriteObjects(" }\r\n"); this.WriteObjects("\r\n"); #line 111 "P:\zetbox\Zetbox.DalProvider.EF.Generator\Templates\Properties\EnumerationPropertyTemplate.cst" EfScalarPropHelper.ApplyBackingStoreDefinition(this, enumType, backingName, efName); #line 112 "P:\zetbox\Zetbox.DalProvider.EF.Generator\Templates\Properties\EnumerationPropertyTemplate.cst" this.WriteObjects(" \r\n"); this.WriteObjects(" /// <summary>EF sees only this property, for ", UglyXmlEncode(name), "</summary>\r\n"); this.WriteObjects(" [XmlIgnore()]\r\n"); this.WriteObjects(" [EdmScalarProperty()]\r\n"); this.WriteObjects(" public int", isNullable ? "?" : String.Empty, " ", efName, "\r\n"); this.WriteObjects(" {\r\n"); this.WriteObjects(" get\r\n"); this.WriteObjects(" {\r\n"); this.WriteObjects(" return (int", isNullable ? "?" : String.Empty, ")this.", name, ";\r\n"); this.WriteObjects(" }\r\n"); this.WriteObjects(" set\r\n"); this.WriteObjects(" {\r\n"); this.WriteObjects(" this.", name, " = (", enumType, ")value;\r\n"); this.WriteObjects(" }\r\n"); this.WriteObjects(" }\r\n"); this.WriteObjects(" \r\n"); #line 129 "P:\zetbox\Zetbox.DalProvider.EF.Generator\Templates\Properties\EnumerationPropertyTemplate.cst" AddSerialization(serializationList); }