This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Security.Principal; | |
namespace MyApp.Models.Authentication | |
{ | |
public class CustomIdentity : GenericIdentity, ICustomIdentity | |
{ | |
public CustomIdentity(string userId, string displayName) | |
: base(string.IsNullOrEmpty(displayName) ? string.Empty : displayName, "Forms") | |
{ | |
UserId = userId; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public IDocumentSession session { get; protected set; } | |
protected override void OnActionExecuting(ActionExecutingContext filterContext) | |
{ | |
session = MvcApplication.Store.OpenSession(); | |
} | |
protected override void OnActionExecuted(ActionExecutedContext filterContext) | |
{ | |
if (filterContext.IsChildAction) | |
return; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class HttpContextFactory | |
{ | |
private static HttpContextBase context; | |
public HttpContextFactory() {} | |
public void setHttpContext(HttpContextBase c) | |
{ | |
context = c; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Configuration; | |
using System.Linq; | |
using System.Web.Mvc; | |
using FlexProviders.Aspnet; | |
using FlexProviders.Membership; | |
using FlexProviders.Raven; | |
using FlexProviders.Roles; | |
using LogMeIn.Models; | |
using Raven.Client; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x.ForSingletonOf<IDocumentStore>().Use(() => { | |
var ds= new DocumentStore(); | |
ds.ConnectionStringName = "Raven"; | |
ds.Initialize(); | |
return ds; | |
}); | |
x.For<IDocumentSession>().HybridHttpOrThreadLocalScoped().Use(ctx => | |
{ | |
return ctx.GetInstance<IDocumentStore>().OpenSession(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private readonly IDocumentSession session; | |
public HomeController(IDocumentSession s) | |
{ | |
session = s; | |
} | |
public ActionResult Index() | |
{ | |
var tempObject = Tuple.Create("Hello World!", DateTime.Now); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PeopleIndex : AbstractMultiMapIndexCreationTask | |
{ | |
public PeopleIndex() | |
{ | |
AddMap<User>(users => from user in users select new { user.Name }); | |
AddMap<Person>(p => from person in p select new { person.Name }); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private IDocumentSession _session; | |
public PeopleController(IDocumentSession session) | |
{ | |
_session = session; | |
} | |
public ActionResult Index() | |
{ // insert a User & a Person into RavenDB | |
_session.Store(new User { Email = "user@domain.co", Name = "user 1", UserName = "user1" }); | |
_session.Store(new Person { Email = "person@domain.co", Name = "person 1", PersonName = "person1" }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class User | |
{ | |
public string Name { get; set; } | |
public string Email { get; set; } | |
public string UserName { get; set; } | |
} | |
public class Person | |
{ | |
public string Name { get; set; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<int> contactIds=MyContactIds() //count of contactIds is more than 2100 rows | |
var profiles = db.Profiles.AsEnumerable() | |
.Join(contactIds, p => p.ContactId, ci => ci, (p, ci) => p) | |
.ToList(); |