public static bool ShouldUseTableValuedParameters <TEntity>( this SqlServerManipulationExtensionsConfiguration configuration, IReadOnlyCollection <IProperty> properties, IReadOnlyCollection <TEntity> entities) { if (configuration == null) { throw new ArgumentNullException(nameof(configuration)); } EntityConifugration entityConfiguration = configuration.GetEntityConifugrationOrDefault <TEntity>(); int rowThreshold = entityConfiguration?.UseTableValuedParametersRowTreshold ?? configuration.DefaultUseTableValuedParametersRowTreshold; int parameterThreshold = entityConfiguration?.UseTableValuedParametersParameterCountTreshold ?? configuration.DetaultUseTableValuedParametersParameterCountTreshold; return(entities.Count > rowThreshold || entities.Count * properties.Count > parameterThreshold); }
public static bool DoesEntityHaveTriggers <TEntity>(this SqlServerManipulationExtensionsConfiguration configuration) => configuration.GetEntityConifugrationOrDefault <TEntity>()?.HasTrigger ?? false;
private static EntityConifugration GetEntityConifugrationOrDefault <TEntity>(this SqlServerManipulationExtensionsConfiguration configuration) => configuration.GetEntityConifugrationOrDefault(typeof(TEntity));
public static bool ShouldUseMerge <TEntity>(this SqlServerManipulationExtensionsConfiguration configuration) => configuration.GetEntityConifugrationOrDefault <TEntity>()?.UseMerge ?? configuration.UseMerge;
public static bool ShouldUseMemoryOptimizedTableTypes(this SqlServerManipulationExtensionsConfiguration configuration, Type entityType) => configuration.GetEntityConifugrationOrDefault(entityType)?.UseMemoryOptimizedTableTypes ?? configuration.UseMemoryOptimizedTableTypes;
public static ITableValuedParameterInterceptor GetTvpInterceptor(this SqlServerManipulationExtensionsConfiguration configuration, Type entityType) => configuration.GetEntityConifugrationOrDefault(entityType)?.TableValuedParameterInterceptor ?? DefaultTableValuedParameterInterceptor.Instance;
public static SqlServerTableTypeIndex GetTableTypeIndex(this SqlServerManipulationExtensionsConfiguration configuration, Type entityType) => configuration.GetEntityConifugrationOrDefault(entityType)?.TableTypeIndex ?? configuration.DefaultTableTypeIndex;
public static int GetHashIndexBucketCount(this SqlServerManipulationExtensionsConfiguration configuration, Type entityType) => configuration.GetEntityConifugrationOrDefault(entityType)?.HashBucketSizetHashIndexBucketCount ?? configuration.DefaultHashIndexBucketCount;