예제 #1
0
        public static IReadOnlyList <object> Deserialize <T> (this DbContext context, IDbContextSerializer <T> deserializer, T readable, ResolveConflict?resolveConflict = null)
        {
            if (deserializer == null)
            {
                throw new ArgumentNullException(nameof(deserializer));
            }

            var reader = deserializer.CreateReader(readable);

            using (reader as IDisposable)
                return(context.Deserialize(reader, resolveConflict));
        }
예제 #2
0
        public static void AcceptChanges <T> (this DbContext context, IDbContextSerializer <T> deserializer, T readable)
        {
            if (deserializer == null)
            {
                throw new ArgumentNullException(nameof(deserializer));
            }

            var reader = deserializer.CreateReader(readable);

            using (reader as IDisposable)
                context.AcceptChanges(reader);
        }