private IPropDef CreatePrimaryKeyProp()
        {
            var      propertyName = PropNamingConvention.GetIDPropertyName(_classType);
            IPropDef propDef      = new PropDef(propertyName, typeof(Guid), PropReadWriteRule.WriteNew, null);

            this.ClassDef.PropDefcol.Add(propDef);
            return(propDef);
        }
Ejemplo n.º 2
0
        ///<summary>
        /// Returns the PKPropName that will be used for the underlying type.
        /// The PKPropName will either be determined by attributes or by
        /// convention e.g. ClassNameID.
        ///</summary>
        ///<returns></returns>
        public virtual string GetPKPropName()
        {
            if (!this.IsBaseTypeBusinessObject && this.HasBaseType && !this.BaseType.IsGenericType)
            {
                return(this.BaseType.GetPKPropName());
            }

            var propName = GetPKPropNameFromClassDef();

            if (!string.IsNullOrEmpty(propName))
            {
                return(propName);
            }
            propName = this.GetPKPropNameFromAttribute();
            return(propName ?? PropNamingConvention.GetIDPropertyName(this));
        }