public static IRepository Init(this IRepository repository)
        {
            foreach (var entity in repository.Query <DbEntity>())
            {
                repository.Delete(entity);
            }

            foreach (var entity in repository.Query <DbEntityByInt>())
            {
                repository.Delete(entity);
            }

            foreach (var entity in repository.Query <DbEntityAsGuid>())
            {
                repository.Delete(entity);
            }

            foreach (var entity in repository.Query <DbEntityReference>())
            {
                repository.Delete(entity);
            }

            foreach (var entity in repository.Query <DbEntityItem>())
            {
                repository.Delete(entity);
            }

            foreach (var entity in repository.Query <DbEntityQuery>())
            {
                repository.Delete(entity);
            }

            foreach (var entity in repository.Query <DbEntityReference>())
            {
                repository.Delete(entity);
            }

            foreach (var entity in repository.Query <DbEntityQueryAsItem>())
            {
                repository.Delete(entity);
            }

            repository.Flush();

            Pleasure.Do10((i) => repository.Save(Pleasure.Generator.Invent <DbEntityQuery>(dsl => dsl.GenerateTo(r => r.Reference)
                                                                                           .Callback(query =>
            {
                var item = Pleasure.Generator.Invent <DbEntityQueryAsItem>(factoryDsl => factoryDsl.Tuning(r => r.Parent, query));
                query.Items.Add(item);
            }))));
            repository.Flush();
            Pleasure.Sleep100Milliseconds(); // wait for apply data base.
            return(repository);
        }
Beispiel #2
0
 public override void Execute()
 {
     Pleasure.Do10(i => this.EventBroker.Publish(new FakeEvent()));
 }
 protected override void Execute()
 {
     Pleasure.Do10(i => Repository.Delete <FakeEntityForNew>(i));
 }
Beispiel #4
0
 public override void Execute()
 {
     Pleasure.Do10(i => this.Repository.Delete <FakeEntityForNew>(i));
 }