Base solution for your next web application

Activities of "sison"

Answer

But I have tried register Generic Repository like follows,

IocManager.Register(typeof(IGenericRepository<>),
              typeof(GenericRepository<>),
              Abp.Dependency.DependencyLifeStyle.Transient);

this been resulted the same.

thanks for the help, but one more problem is i couldn't insert new created tenant Id to the table with seed data before login.

Question

Hi,

I have created a generic repository to write common method for all repositories. but it is not working for me. what i have done is, created IGenericRepository under core and implemented IRepository then created GenericRepository under EnitityFramework and implemented SampleProBaseRepository as well as IGenericRepository(Codes are bellow).

This is not working for me, please cross check the code and let me know if there any mistake i did or i should add some more code to the work the same.

IGenericRepository:

public interface IGenericRepository<TEntity, TPrimaryKey> : IRepository<TEntity, TPrimaryKey> where TEntity : class,IEntity<TPrimaryKey>
    {
        Task SaveChangesAsync();
    }
    public interface IGenericRepository<TEntity> : IRepository<TEntity> where TEntity : class,IEntity<int>
    {
        Task SaveChangesAsync();
    }

GenericRepository

public class GenericRepository<TEntity, PrimaryKey> : SampleRepositoryBase<TEntity, PrimaryKey>, IGenericRepository<TEntity, PrimaryKey> where TEntity : class,IEntity<PrimaryKey>
    {
        protected GenericRepository(IDbContextProvider<SampleDbContext> dbContextProvider)
            : base(dbContextProvider)
        {

        }

        public async Task SaveChangesAsync()
        {
            await Context.SaveChangesAsync();
        }
    }
    public class GenericRepository<TEntity> : SampleRepositoryBase<TEntity>, IGenericRepository<TEntity>  where TEntity : class,IEntity<int>
    {
        protected GenericRepository(IDbContextProvider<SampleDbContext> dbContextProvider)
            : base(dbContextProvider)
        {

        }

        public async Task SaveChangesAsync()
        {
            await Context.SaveChangesAsync();
        }
    }

How could i create a seed to insert default data to the last created Db with multi tenancy?. or should I use any other method to insert default data..?

I need to insert some data to new Db at the time when i create new tenancy.I have created a seed method with tenant Id 1, as described in sample application. but it not works for me,the data are inserted into main Db only.

Showing 11 to 14 of 14 entries