本文整理汇总了C#中ISessionProvider类的典型用法代码示例。如果您正苦于以下问题:C# ISessionProvider类的具体用法?C# ISessionProvider怎么用?C# ISessionProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ISessionProvider类属于命名空间,在下文中一共展示了ISessionProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SecurityAuthenticationProvider
public SecurityAuthenticationProvider(IStorageApplication<User> userStorageApplication, IHashProvider hashProvider, ISecurityAccessTokenProvider securityAccessTokenProvider, ISessionProvider sessionProvider)
{
_userStorageApplication = userStorageApplication;
_hashProvider = hashProvider;
_securityAccessTokenProvider = securityAccessTokenProvider;
_sessionProvider = sessionProvider;
}
示例2: Session
public Session(IResultTransformer resultTransformer, IDao<Bank> bankDao, IDao<LogModel> logDao, ISessionProviderFactory<NHibernateStatelessSession> sessionProviderFactory)
: base(resultTransformer)
{
this.bankDao = bankDao;
this.logDao = logDao;
logSessionProvider = sessionProviderFactory.Build("LOG");
}
示例3: AssemblyByConfigurationBootstrap
public AssemblyByConfigurationBootstrap(IConfigurationProvider configurationProvider, ISessionProvider sessionProvider)
{
if (configurationProvider == null) throw new ArgumentNullException(nameof(configurationProvider));
if (sessionProvider == null) throw new ArgumentNullException(nameof(sessionProvider));
_configurationProvider = configurationProvider;
_sessionProvider = sessionProvider;
}
示例4: PollModule
public PollModule(TinyIoc.TinyIoCContainer container, PollService pollService = null, ISessionProvider sessionProvider = null)
{
if (container == null) throw new ArgumentNullException("container");
if (!(sessionProvider is DefaultSessionProvider)) _SessionProvider = sessionProvider;
if (pollService == null)
{
container.Register<PollService>().AsSingleton();
pollService = container.Resolve<PollService>();
}
_PollService = pollService;
Get["/Poll/Register"] = x =>
{
var sp = _SessionProvider;
if (sp == null) sp = new DefaultSessionProvider(Request);
var response = Response.AsJson(_PollService.Register(Request.UserHostAddress, sp.SessionId));
if (sp is DefaultSessionProvider)
{
response = response.WithCookie(DefaultSessionProvider.SessionIdCookieName, sp.SessionId);
}
return response;
};
Get["/Poll/Wait"] = x =>
{
string clientId = Request.Query.clientId;
ulong seqCode = Request.Query.seqCode;
return Response.AsJson(_PollService.Wait(clientId, seqCode));
};
}
示例5: NestWebService
public NestWebService() {
_deserializer = ServiceContainer.GetService<INestWebServiceDeserializer>();
_sessionProvider = ServiceContainer.GetService<ISessionProvider>();
_analyticsService = ServiceContainer.GetService<IAnalyticsService>();
_webRequestProvider = ServiceContainer.GetService<IWebRequestProvider>();
_timestampProvider = ServiceContainer.GetService<ITimestampProvider>();
}
示例6: PollModule
public PollModule(TinyIoc.TinyIoCContainer container, IPollService pollService = null, ISessionProvider sessionProvider = null)
{
if (container == null) throw new ArgumentNullException("container");
if (!(sessionProvider is DefaultSessionProvider)) _SessionProvider = sessionProvider;
if (pollService == null)
{
container.Register<IPollService, PollService>().AsSingleton();
pollService = container.Resolve<IPollService>();
}
_PollService = pollService as PollService;
if (pollService == null) throw new ApplicationException("Support Nany.LongPoll.PollService implementation only");
Get["/Poll/Register"] = x =>
{
var sp = _SessionProvider;
if (sp == null) sp = new DefaultSessionProvider(Request);
var response = Response.AsJson(_PollService.Register(Request.UserHostAddress, sp.SessionId));
if (sp is DefaultSessionProvider)
{
response = response.WithCookie(DefaultSessionProvider.SessionIdCookieName, sp.SessionId);
}
return response;
};
Get["/Poll/Wait"] = x =>
{
string clientId = Request.Query.clientId;
ulong seqCode = Request.Query.seqCode;
return Response.AsText(JsonConvert.SerializeObject(_PollService.Wait(clientId, seqCode)), "application/json");
};
}
示例7: WebLoginModule
public WebLoginModule(ISessionProvider sessionProvider)
{
_sessionProvider = sessionProvider;
Get["/weblogin"] = parameters => View["web/login.html"];
Get["/weblogout"] = parameters => this.Logout("/");
Post["/weblogin"] = parameters =>
{
using (var session = _sessionProvider.GetSession())
{
string username = Request.Form["UserName"];
string password = Request.Form["Password"];
var login = session.Query<Login>()
.SingleOrDefault(
x => x.Username == username && x.Password == password);
if (login == null)
return Response.AsRedirect("/weblogin", RedirectResponse.RedirectType.SeeOther);
if(login.Roles.Contains(Roles.SuperAdmin))
return this.Login(login.AuthenticationKey, DateTime.Now.AddDays(1), "/admin");
if (login.Roles.Contains(Roles.ClientAdmin))
return this.Login(login.AuthenticationKey, DateTime.Now.AddDays(1), "/web/views/livedetails.html?" + login.ClientId);
if (login.Roles.Contains(Roles.ClientUser))
return this.Login(login.AuthenticationKey, DateTime.Now.AddDays(1), "/mobile/views/startup.html");
return this.Login(login.AuthenticationKey, fallbackRedirectUrl: "/");
}
};
}
示例8: UserService
public UserService(ISessionProvider sessionProvider)
{
ISessionFactory sessionFactory = sessionProvider.GetSessionFactory();
_unitOfWork = new UnitOfWork(sessionFactory);
_repository = new Repository<int, User>(_unitOfWork.Session);
}
示例9: MomentController
public MomentController(ISessionProvider<AefSession> sessionProvider,
IMomentManager momentManager,
IMomentFileManager momentFileManager,
IMomentLikeManager momentLikeManager,
IMomentCommentManager momentCommentManager,
IAccessTimeManager accessTimeManager,
IStaffManager staffManager,
IOrgManager orgManager) : base(sessionProvider)
{
Args.NotNull(momentManager, nameof(momentManager));
Args.NotNull(momentFileManager, nameof(momentFileManager));
Args.NotNull(momentManager, nameof(momentManager));
Args.NotNull(staffManager, nameof(staffManager));
Args.NotNull(accessTimeManager, nameof(accessTimeManager));
Args.NotNull(orgManager, nameof(orgManager));
m_MomentManager = momentManager;
m_MomentFileManager = momentFileManager;
m_MomentLikeManager = momentLikeManager;
m_MomentCommentManager = momentCommentManager;
m_SessionProvider = sessionProvider;
m_StaffManager = staffManager;
m_AccessTimeManager = accessTimeManager;
m_OrgManager = orgManager;
}
示例10: UserInformationDtoFactory
/// <summary>
/// Initializes a new instance of the <see cref="UserInformationDtoFactory"/> class.
/// </summary>
/// <param name="sessionProvider">The session provider.</param>
/// <param name="currentClaimsPrincipalService">The current claims principal service.</param>
public UserInformationDtoFactory(
ISessionProvider sessionProvider,
ICurrentClaimsPrincipalService currentClaimsPrincipalService )
{
_sessionProvider = sessionProvider;
_currentClaimsPrincipalService = currentClaimsPrincipalService;
}
示例11: MonitorModule
public MonitorModule(ISessionProvider sessionProvider)
: base("/monitor")
{
_sessionProvider = sessionProvider;
Get["/live"] = parameters =>
{
using (var session = _sessionProvider.GetSession())
{
return session.Load<MonitorSite>("MonitorSites/1").Text;
}
};
Get["/createlive"] = parameters =>
{
using (var session = _sessionProvider.GetSession())
{
if (session.Load<MonitorSite>("MonitorSites/1") == null)
{
session.Store(new MonitorSite
{
Id = "MonitorSites/1",
Text = "I was fetched from the database",
});
session.SaveChanges();
return "Message was stored to the database.";
}
else
{
return Response.AsRedirect("/monitor/live");
}
}
};
}
示例12: EventsDispatcher
public EventsDispatcher(ISessionProvider sessionProvider, IProvideClientSettings clientSettings)
{
_sessionProvider = sessionProvider;
_clientSettings = clientSettings;
_eventConsumers = new Dictionary<Type, List<Type>>();
var consumerTypes = (from type in GetType().Assembly.GetTypes()
where type.GetInterfaces().Any(x => x.IsGenericType && x.GetGenericTypeDefinition() == typeof(IConsumerOf<>))
select type).ToArray();
foreach (var consumerType in consumerTypes)
{
foreach (var interfaceType in consumerType.GetInterfaces())
{
if(interfaceType.IsGenericType == false)
continue;
if(interfaceType.GetGenericTypeDefinition() == typeof(IConsumerOf<>) == false)
continue;
if(_eventConsumers.ContainsKey(interfaceType) == false)
_eventConsumers.Add(interfaceType, new List<Type>());
if(_eventConsumers[interfaceType].Contains(consumerType))
continue;
_eventConsumers[interfaceType].Add(consumerType);
}
}
}
示例13: SetUp
public override void SetUp()
{
base.SetUp();
CreateDatabaseSchema();
sessionProvider = engine.Resolve<ISessionProvider>();
repository = new ContentItemRepository(sessionProvider);
all = new ContentItem []
{
root = CreateOneItem<Definitions.PersistableItem>(0, "page", null),
child1 = CreateOneItem<Definitions.PersistableItem>(0, "page1", root),
grandchild1 = CreateOneItem<Definitions.PersistableItem>(0, "page1_1", child1),
part1 = CreateOneItem<Definitions.PersistablePart>(0, "part1", child1),
part2 = CreateOneItem<Definitions.PersistablePart>(0, "part1", child1),
child2 = CreateOneItem<Definitions.PersistableItem>(0, "page2", root),
version = CreateOneItem<Definitions.PersistableItem>(0, "page1", null)
};
part1.ZoneName = "Left";
part2.ZoneName = "RecursiveLeft";
child1["Hello"] = "World";
child2["Age"] = 2.7;
grandchild1["Age"] = 1.7;
version.VersionOf = child1;
foreach (var item in all)
repository.SaveOrUpdate(all);
}
示例14: TaskNewsController
public TaskNewsController(ISessionProvider<AefSession> sessionProvider,
ITaskNewsManager taskNewsManager)
: base(sessionProvider)
{
if (taskNewsManager == null) throw new ArgumentNullException(nameof(taskNewsManager));
m_TaskNewsManager = taskNewsManager;
}
示例15: AdminModule
public AdminModule(ISessionProvider sessionProvider, IDispatchEvents eventDispatcher)
: base(sessionProvider, eventDispatcher, "/api/admin")
{
Post["/clients/create"] = parameters =>
{
var createCommand = this.Bind<CreateClientCommand>();
RavenSession.Advanced.UseOptimisticConcurrency = true;
var newClient = new Client
{
Name = createCommand.Name,
};
RavenSession.Store(newClient);
RavenSession.Store(new UniqueClientName
{
Id = createCommand.Name,
});
UncommitedEvents.Add(new ClientCreated
{
Id = newClient.Id,
Name = newClient.Name,
});
return HttpStatusCode.Processing;
};
Get["/clients/{clientId}"] = parameters =>
{
var client = RavenSession.Load<Client>(string.Format("clients/{0}", parameters.clientId));
return Response.AsJson(new { client });
};
}