/// <summary> /// The exists. /// </summary> /// <param name="collection"> /// The collection. /// </param> /// <param name="entity"> /// The entity. /// </param> /// <typeparam name="T"> /// The type of the <see cref="IEntity"/> /// </typeparam> /// <returns> /// The <see cref="bool"/>. /// </returns> public static bool Exists <T>(this IEntityCollection collection, T entity) where T : class, IEntity { var resolved = collection.ResolveValidatedProvider(entity); return(resolved != null && resolved.Exists(entity)); }