Exemplo n.º 1
0
        /// <summary>
        /// Compares two entities using
        /// <see cref="JsonEqualityComparer{TEntity}"/>.
        /// </summary>
        public static bool JsonEquals <TEntity>(this TEntity left, TEntity right, JsonNet.JsonSerializerSettings settings)
            where TEntity : class
        {
            _ = settings ?? throw new ArgumentNullException(nameof(settings));

            var equalityComparer = new JsonEqualityComparer <TEntity>(settings);

            return(equalityComparer.Equals(left, right));
        }
Exemplo n.º 2
0
        /// <inheritdoc cref="JsonEquals{TEntity}(TEntity, TEntity, JsonNet.JsonSerializerSettings)"/>
        public static bool JsonEquals <TEntity>(this TEntity left, TEntity right, TextJson.JsonSerializerOptions options)
            where TEntity : class
        {
            _ = options ?? throw new ArgumentNullException(nameof(options));

            var equalityComparer = new JsonEqualityComparer <TEntity>(options);

            return(equalityComparer.Equals(left, right));
        }