CustomRegisterService overwrite always first user id

Hello, I’m trying to implement my custom register service based on my custom user auth but I’m having problems when I send a new registration request.
It seems it always overwrites my first user in the db (the id isn’t incremented).
I define my authentication system like this:

Plugins.Add(
    new AuthFeature(() => new CustomUserSession(),
        new IAuthProvider[]
        {
            new CustomAuthProvider(),
        }
   ));

this.RegisterService<CustomRegisterService>("/register");
this.RegisterAs<RegistrationValidator, IValidator<Register>>();

container.Register<IUserAuthRepository>(c => new OrmLiteAuthRepository(c.Resolve<IDbConnectionFactory>()));

var authRepo = (OrmLiteAuthRepository)container.Resolve<IUserAuthRepository>();
authRepo.InitSchema();

Here is my custom registration service class (I basically overwrited, with the “new” keyword, the Post and Put methods without change them for now):

[DefaultRequest(typeof(Register))]
public class CustomRegisterService : RegisterService<CustomUserAuth>
{
    public new object Put(Register request)
    {
        return Post(request);
    }

    public new object Post(Register request)
    {
        if (HostContext.GlobalRequestFilters == null
            || !HostContext.GlobalRequestFilters.Contains(ValidationFilters.RequestFilter)) //Already gets run
        {
            if (RegistrationValidator != null)
            {
                RegistrationValidator.ValidateAndThrow(request, ApplyTo.Post);
            }
        }

        var userAuthRepo = AuthRepo.AsUserAuthRepository(GetResolver());

        if (ValidateFn != null)
        {
            var validateResponse = ValidateFn(this, HttpMethods.Post, request);
            if (validateResponse != null)
                return validateResponse;
        }

        RegisterResponse response = null;
        var session = this.GetSession();
        var newUserAuth = ToUserAuth(request);
        var existingUser = userAuthRepo.GetUserAuth(session, null);

        var registerNewUser = existingUser == null;
        var user = registerNewUser
            ? userAuthRepo.CreateUserAuth(newUserAuth, request.Password)
            : userAuthRepo.UpdateUserAuth(existingUser, newUserAuth, request.Password);

        if (request.AutoLogin.GetValueOrDefault())
        {
            using (var authService = base.ResolveService<AuthenticateService>())
            {
                var authResponse = authService.Post(
                    new Authenticate
                    {
                        provider = CredentialsAuthProvider.Name,
                        UserName = request.UserName ?? request.Email,
                        Password = request.Password,
                        Continue = request.Continue
                    });

                if (authResponse is IHttpError)
                    throw (Exception)authResponse;

                var typedResponse = authResponse as AuthenticateResponse;
                if (typedResponse != null)
                {
                    response = new RegisterResponse
                    {
                        SessionId = typedResponse.SessionId,
                        UserName = typedResponse.UserName,
                        ReferrerUrl = typedResponse.ReferrerUrl,
                        UserId = user.Id.ToString(CultureInfo.InvariantCulture),
                    };
                }
            }
        }

        if (registerNewUser)
        {
            session = this.GetSession();
            session.OnRegistered(this.Request, session, this);
            if (AuthEvents != null)
                AuthEvents.OnRegistered(this.Request, session, this);
        }

        if (response == null)
        {
            response = new RegisterResponse
            {
                UserId = user.Id.ToString(CultureInfo.InvariantCulture),
                ReferrerUrl = request.Continue
            };
        }

        var isHtml = Request.ResponseContentType.MatchesContentType(MimeTypes.Html);
        if (isHtml)
        {
            if (string.IsNullOrEmpty(request.Continue))
                return response;

            return new HttpResult(response)
            {
                Location = request.Continue
            };
        }

        return response;
    }
}

here is my POST request:

api/register?UserName=test&DisplayName=TestUser&Email=test@test.com&Password=test

I don’t pass any Id so I was hoping it would be autoincremented by default… I’m wrong?

Don’t inherit services, if you want to customize it, take a copy and customize it to suit your needs.

The Register Service either Updates or Creates a new user based on the Users Session:

//Gets UserAuth identified by Users Session
var existingUser = userAuthRepo.GetUserAuth(session, null); 

//Either updates the existing User or registers a new User if it doesn't exist
var registerNewUser = existingUser == null;
var user = registerNewUser
    ? userAuthRepo.CreateUserAuth(newUserAuth, request.Password)
    : userAuthRepo.UpdateUserAuth(existingUser, newUserAuth, request.Password);

You don’t need to hope, you have the source code to know exactly what it is doing, which line of code are you expecting does this?

In future please isolate any support questions to just the few lines of code that are problematic or that you don’t understand, i.e. don’t just throw a whole code dump then ask others to debug/execute the entire thing for you or ask why it doesn’t work the way you want it to work. You’re taking existing code with existing behavior, you need to first understand what the code you’re copying does then change it to work the way you want it to work. Ask us if you don’t understand what a particular line does or why it doesn’t work how you expected it to work. Understand that you’re in the best position to debug your own source code (i.e. no-one else has a new project configured to run your Services). Debug your code and identify which lines of code isn’t doing what you want/expect, we can then help and explain what the code does.

Thank you Demis for your patience; my purpose was to give the best view of my code in the best way I can because I know… I’m the only one that can debug it.
Anyway, I found the problem with my code… I was too much focused in what I needed that I didn’t notice that my user was already logged-in, so he always overwrite/update his own data, I edited the Post method to get it work as I wished.
Thank you again.