<commit_before>﻿namespace AcademyGrandPrix.Data
{
    using Microsoft.AspNet.Identity.EntityFramework;

    using AcademyGrandPrix.Data.Models;
    
    public class AcademyGrandPrixDbContext : IdentityDbContext<User>
    {
        public AcademyGrandPrixDbContext()
            : base("DefaultConnection", throwIfV1Schema: false)
        {
        }

        public static AcademyGrandPrixDbContext Create()
        {
            return new AcademyGrandPrixDbContext();
        }
    }
}
<commit_msg>Added ApplyAuditInfoRules() method in AcademyGrandPrixDbContext class<commit_after>﻿namespace AcademyGrandPrix.Data
{
    using System;
    using System.Data.Entity;
    using System.Linq;

    using Microsoft.AspNet.Identity.EntityFramework;

    using AcademyGrandPrix.Data.Models;
    using AcademyGrandPrix.Data.Common.Models;

    public class AcademyGrandPrixDbContext : IdentityDbContext<User>
    {
        public AcademyGrandPrixDbContext()
            : base("DefaultConnection", throwIfV1Schema: false)
        {
        }

        public static AcademyGrandPrixDbContext Create()
        {
            return new AcademyGrandPrixDbContext();
        }

        public override int SaveChanges()
        {
            this.ApplyAuditInfoRules();
            return base.SaveChanges();
        }

        private void ApplyAuditInfoRules()
        {
            // Approach via @julielerman: http://bit.ly/123661P
            foreach (var entry in
                this.ChangeTracker.Entries()
                    .Where(
                        e =>
                        e.Entity is IAuditInfo && ((e.State == EntityState.Added) || (e.State == EntityState.Modified))))
            {
                var entity = (IAuditInfo)entry.Entity;
                if (entry.State == EntityState.Added && entity.CreatedOn == default(DateTime))
                {
                    entity.CreatedOn = DateTime.Now;
                }
                else
                {
                    entity.ModifiedOn = DateTime.Now;
                }
            }
        }
    }
}

{'fraction_non_alphanumeric': 0.08321308321308321, 'fraction_numerical': 0.003848003848003848, 'mean_word_length': 1.7659574468085106, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4440214', 'n_tokens_mistral': 556, 'n_tokens_neox': 519, 'n_words': 98}