예제 #1
0
    }      // note you can return Repository<,>   if the type requires 2 generic params

    // Now instantiate Class Type with the Generic type passing in a constructor param
    private IRepositoryBase <TPoco> InstantiateRepository(BosBaseDbContext context, Type repType, params Type[] pocoTypes)
    {
        Type   repGenericType = repType.MakeGenericType(pocoTypes);
        object repInstance    = Activator.CreateInstance(repGenericType, context);

        return((IRepositoryBase <TPoco>)repInstance);
    }
 public RepositoryBase(BosBaseDbContext context) { Context = context; }