<commit_before>﻿using System;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration.Configuration;
using EntityFramework.Filters;

namespace EntityFramework.SoftDeletable {
    public static class DbContextExtensions {
        private const String SoftDeletableFilterName = "SoftDeletable";

        public static void EnableSoftDeletableFilter(this DbContext dbContext) {
            dbContext.EnableFilter(SoftDeletableFilterName);
		}

		public static void DisableSoftDeletableFilter(this DbContext dbContext) {
			dbContext.DisableFilter(SoftDeletableFilterName);
		}

		public static void AddSoftDeletableFilter(this ConventionsConfiguration conventions) {
            conventions.Add(FilterConvention.Create(SoftDeletableFilterName, SoftDeletable.IsNotDeletedExpression));
        }
    }
}
<commit_msg>add extensions to control filtering by specific type<commit_after>﻿using System;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration.Configuration;
using EntityFramework.Filters;

namespace EntityFramework.SoftDeletable {
    public static class DbContextExtensions {
        private const String SoftDeletableFilterName = "SoftDeletable";

        public static void EnableSoftDeletableFilter(this DbContext dbContext) {
            dbContext.EnableFilter(SoftDeletableFilterName);
        }

        public static void DisableSoftDeletableFilter(this DbContext dbContext) {
            dbContext.DisableFilter(SoftDeletableFilterName);
        }

        public static void AddSoftDeletableFilter(this ConventionsConfiguration conventions) {
            conventions.Add(FilterConvention.Create(SoftDeletableFilterName, SoftDeletable.IsNotDeletedExpression));
        }

        public static void EnableSoftDeletableFilter<TSoftDeletable>(this DbContext dbContext) where TSoftDeletable : ISoftDeletable {
            dbContext.EnableFilter(SoftDeletableFilterName + typeof(TSoftDeletable).Name);
        }

        public static void DisableSoftDeletableFilter<TSoftDeletable>(this DbContext dbContext) where TSoftDeletable : ISoftDeletable {
            dbContext.DisableFilter(SoftDeletableFilterName + typeof(TSoftDeletable).Name);
        }

        public static void AddSoftDeletableFilter<TSoftDeletable>(this ConventionsConfiguration conventions) where TSoftDeletable : ISoftDeletable {
            conventions.Add(FilterConvention.Create(SoftDeletableFilterName + typeof(TSoftDeletable).Name, SoftDeletable.IsNotDeletedExpression));
        }
    }
}
{'fraction_non_alphanumeric': 0.06230031948881789, 'fraction_numerical': 0.0, 'mean_word_length': 4.529801324503311, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3949871', 'n_tokens_mistral': 667, 'n_tokens_neox': 644, 'n_words': 123}