Ejemplo n.º 1
0
        /// <summary>
        /// Gets the modified properties of this entity, not including query properties and properties of base entity's.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <returns>The modified properties</returns>
        public Dictionary <string, object> GetModifiedProperties(Type type)
        {
            EntityConfiguration ec = MetaDataManager.GetEntityConfiguration(type.ToString());

            if (ec.BaseEntity == null && type == this.GetType())
            {
                return(changedProperties);
            }

            Check.Require(typeof(Entity).IsAssignableFrom(type), "type must be an Entity");

            List <string> toRemoveItems = new List <string>();

            foreach (string item in changedProperties.Keys)
            {
                PropertyConfiguration pc = ec.GetPropertyConfiguration(item);
                if (pc == null || pc.IsInherited || pc.IsPrimaryKey)
                {
                    toRemoveItems.Add(item);
                }
            }
            Dictionary <string, object> retProperties = new Dictionary <string, object>();

            foreach (string item in changedProperties.Keys)
            {
                if (!toRemoveItems.Contains(item))
                {
                    retProperties.Add(item, changedProperties[item]);
                }
            }
            return(retProperties);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Gets the create property mapping column names.
 /// </summary>
 /// <param name="type">The type.</param>
 /// <returns></returns>
 public static string[] GetCreatePropertyMappingColumnNames(Type type)
 {
     return(GetCreatePropertyMappingColumnNames(MetaDataManager.GetEntityConfiguration(type.ToString())));
 }