31 lines
1016 B
C#
31 lines
1016 B
C#
using System;
|
|
using System.Linq;
|
|
using NHibernate.Linq;
|
|
using Taloyhtio.GeneralSSO.Server.CodeFiles.Entities;
|
|
using Taloyhtio.GeneralSSO.Server.CodeFiles.Infrastructure.DataAccess;
|
|
|
|
namespace Taloyhtio.GeneralSSO.Server.CodeFiles.Repositories.Impl
|
|
{
|
|
public class ClientRepository : AtomicRepositoryBase<Client, int>, IClientRepository
|
|
{
|
|
public ClientRepository(ISessionSource sessionSource)
|
|
: base(sessionSource)
|
|
{
|
|
}
|
|
|
|
public Client GetByClientId(string clientIdentifier)
|
|
{
|
|
return this.GetSession().Linq<Client>().FirstOrDefault(c => c.ClientIdentifier == clientIdentifier);
|
|
}
|
|
|
|
public Client GetByName(string name)
|
|
{
|
|
return this.GetSession().Linq<Client>().FirstOrDefault(c => c.Name == name);
|
|
}
|
|
|
|
public Client GetByClientSecret(string clientSecret)
|
|
{
|
|
return this.GetSession().Linq<Client>().FirstOrDefault(c => c.ClientSecret == clientSecret);
|
|
}
|
|
}
|
|
} |