예제 #1
0
        /// <summary>
        /// Modifies all non key properties of the given objeD.
        /// </summary>
        /// <param name="entity"></param>
        protected void Alter(D entity)
        {
            entity.Name += "modified";

            using (var ctx = new TdsContext())
            {
                ctx.EnsureEntity(entity, entity.GetCheckIfExistsExpression());
            }
        }
예제 #2
0
 /// <summary>
 /// Makes sure the given entity exists in the database with the desired properties.
 /// </summary>
 /// <typeparam name="T">Type of entity</typeparam>
 /// <param name="entity">Entity instance</param>
 /// <param name="ctx">Entity framework context instance</param>
 public static void Ensure <T>(this T entity, TdsContext ctx)
     where T : class, ISelfEnsuringEntity <T>
 {
     ctx.EnsureEntity <T>(entity, entity.GetCheckIfExistsExpression());
 }