Profile cover photo
Profile photo
Wayne Douglas
27 followers
27 followers
About
Wayne's posts

Post has attachment
Jwt Authentication with Ember + SailsJs / Waterlock Part 2 - Google oAuth2
Leading on from part 1  Jwt Authentication with Ember + SailsJs / Waterlock  I decided to continue with the theme by adding the ability to authenticate with a 3rd party authentication service - in this example I'm using Google oAuth2. Now this wasn't simple...

Post has attachment
Jwt Authentication with Ember + SailsJs / Waterlock
Thought I'd knock together a little example of using Waterlock/SailsJs with EmberJs and using JWT as the mechanism. JSON Web Token (JWT) is a JSON-based open standard (RFC 7519) for passing claims between parties in web application environment. The tokens a...

Post has attachment
Jwt Authentication with Ember + SailsJs / Waterlock
Thought I'd knock together a little example of using Waterlock/SailsJs with EmberJs and using JWT as the mechanism. JSON Web Token (JWT) is a JSON-based open standard (RFC 7519) for passing claims between parties in web application environment. The tokens a...

Post has attachment
C# Threading Primers
I've been refreshing my brain on threading in C# recently and have compiled a list of resources I found excellent on the subject. I'll leave them here for future me and also for anyone interested in the topic - save some google bandwidth :) Joe Albahari - T...

Post has attachment

Post has attachment
I have asked this here: http://stackoverflow.com/questions/27375121/servicestack-nhibernate-auth-repo-no-currentsessioncontext-configured but not had a good response.

I have the following configuration:

    _container = new WindsorContainer ();
    var factory = new SessionFactoryManager().CreateSessionFactory();
    _container.Register(Component.For<NHibernate.ISessionFactory>().Instance(factory));

And then elsewhere I have:

    var authRepo = new NHibernateUserAuthRepository (_container.Resolve<NHibernate.ISessionFactory>());
    _container.Register (Component.For<IAuthRepository>().Instance(authRepo));

    public class SessionFactoryManager
    {
        public ISessionFactory CreateSessionFactory()
        {
            try {
                var autoMap = AutoMap.AssemblyOf<Artist>()
                    .Where(t => typeof(Entity).IsAssignableFrom(t))
                    .UseOverridesFromAssemblyOf<LocationMappingOverride>();

                return Fluently.Configure()
                    .Database(PostgreSQLConfiguration.PostgreSQL82.ConnectionString(c => c.FromConnectionStringWithKey("ConnectionString")).AdoNetBatchSize(50))
                    .Mappings(m => m.AutoMappings.Add(autoMap))
                    .Mappings(m => m.FluentMappings.AddFromAssemblyOf<ServiceStack.Authentication.NHibernate.UserAuthMap>())
                    .ExposeConfiguration(TreatConfiguration)
                    .BuildSessionFactory();
            } catch (Exception ex) {
                var m = ex;
            }

            return null;
        }

        protected virtual void TreatConfiguration(NHibernate.Cfg.Configuration configuration)
        {
            configuration.SetProperty("generate_statistics", "true");
            configuration.SetProperty("current_session_context_class", "thread");
            var update = new SchemaUpdate(configuration);
            update.Execute(false, true);
        }
    }

This all works for the rest of my app but when i try to use anything to do with the NH auth repo I get:

    No CurrentSessionContext configured (set the property current_session_context_class)!

Anyone got any clues wha gwarn?

[UPDATE]

In my `AppHost.Configure` method I have added the following:

    this.GlobalRequestFilters.Add ((req, res, vm) => {
        CurrentSessionContext.Bind(container.Resolve<NHibernate.ISession>());
    });

To no avail - I also have no idea how i would dispose of that :p

Also I am confused as ISessionFactory is injected in like every other part of my app:

https://github.com/ServiceStack/ServiceStack/blob/master/src/ServiceStack.Authentication.NHibernate/NHibernateUserAuthRepository.cs#L20

So surely that should just work?

w

Post has attachment
**
This blog is moving to: https://thefield.ghost.io/

Post has attachment
I am getting concurrency exceptions running the released version of 33 - was fine while it was coming from myget afaik - seems to have happened after the golive. It happens on DropAndCreateTables:

var authRepo = new OrmLiteAuthRepository (conn);
authRepo.DropAndReCreateTables ();
Photo

Post has attachment
Working with .NEt on ubuntu
If you're a .NET dev interested in finding out what it's like to develop .NET apps on Ubuntu the cross over can be quite painful. I've created a vagrant box which comes loaded with the bleeding edge MonoDevelop (actually compiled from the source).

To get s...

Hi, I've posted a question to SO. I've kind of answered it myself but still worried I've got something wrong.

http://stackoverflow.com/questions/26234186/servicestack-ormlite-upadte-child-collection

I'm concerned the parent table has the reference data as JSON in the column as well as it being added to the reference table.

Is this normal?
Wait while more posts are being loaded