111,094
社区成员




class Program
{
static ITest i { get; set; }
static void Main(string[] args)
{
i.SayHi("GT");//这里的i总是Null啊
Console.ReadKey();
}
}
public interface ITest
{
void SayHi(string str);
}
class Test : ITest
{
public void SayHi(string str)
{
Console.Write("Hi," + str);
}
}
public class RolesServiceImp:IRolesService
{
[Inject]
public IUnitOfWork UnitOfWork { get; set; }
[Inject]
public IRolesRepository RolesRepository { get; set; }
[Inject]
public IUserProfileRepository UserProfileRepository { get; set; }
[Inject]
public IPermissionsRepository PermissionsRepository { get; set; }
public IEnumerable<webpages_Roles> GetRolesList()
{
var query = RolesRepository.GetAll(); //这两个方法都用到了接口呢,也没new
return query;
}
public IEnumerable<webpages_Roles> Query(Expression<Func<webpages_Roles, bool>> where)
{
return RolesRepository.GetMany(where);//这两个方法都用到了接口呢,也没new
}