Ross McNichol

I am a Solutions Architect

Ross McNichol

A hands-on IT Manager and .NET solutions architect developing desktop apps with WPF, web apps with Aurelia, and mobile apps with Xamarin. Sometimes I have found it difficult to find solutions to enterprise development patterns and solutions. This blog shares some of my favourite solutions to some difficult problems and elegant solutions I have found over the years

Me

My Professional Skills

Broad skills are listed below, most of my software development revolves around the Microsoft platform. C# is my specialty mixing in a bunch of other things like T-SQL, XAML, Typescript, HTML, CSS to get the job done

Web Development 70%
Mobile Development 75%
Desktop development 90%
Server Side Developer 99%

Aurelia Web Development

Aurelia is an elegant componentised SPA framework by Rob Eisenberg who also created Caliburn Micro which I have been using for many years. I have only been using it since late 2016 but it has worked really well for us

Xamarin/WPF desktop application development

More of a hobby at the moment and a way to contribute to the Caliburn micro project on GitHub. I have created the samples for WPF, UWP and Xamarin for official Caliburn micro GitHub repository

MS-SQL, Sqlite Database Development

I have been developing against SQL databases since 2005 and have a plenty of practice with designing building and tuning them. I have recently started using SQlite for integration testing in .NET applications

Solutions Architecture

Being involved in SMB's for my entire career I have had the opportunity to create multiple architectures to suit various needs. I take a great deal of pride in being able to discuss a business need and being able to confidently propose a solution that has a high probability of success

IT management

I am a pretty easy going and understanding manager, but I do expect a personal drive, innovation and results from my staff

Quality Assurance

I have developed over the years a comprehensive and proven quality assurance patterns. I have patterns for unit, integration, functional and manual testing to bring software solutions to their highest quality

0
years developing
0
years managing
0
completed major projects
0
current projects
  • Integration Tests with Entity Framework and SQLite in .NET Core



    I have recently completed a new .NET core API and created a SQLite in memory database so I could do effective integration testing. Given how complex some of the linq we write is mocking it out and just saying yeah its going to return that seems pretty unreliable to me so I built an in memory database and wrote tests against it. So far we have written 120 test that create an in memory database, perform the test and then do a tear down. I takes about 2 minutes to complete everything which I think is pretty good all things considered. The snippet below shows how I setup the creation of the DbContextOptions, this is important because any data context created using this will reference the same in memory database. That's pretty cool if you think about it. Note that I am creating and disposing of one such data context in the setup.
            private readonly DbContextOptions _dbOptions;
    
            public TestSetup()
            {         
                var optionsBuilder = new DbContextOptionsBuilder();
                optionsBuilder.UseSqlite(new SqliteConnection("DataSource=:memory:"));           
                _dbOptions = optionsBuilder.Options;
    
                 using (var setupContext = new DataContext(_dbOptions))
                {
                    var bd = new BaseData(setupContext);
                    setupContext.Database.GetDbConnection().Open();
                    setupContext.Database.EnsureCreated();
                    bd.Initialise();
                }
            }
    
            public DataContext GetDataContext()
            {
                return new DataContext(_dbOptions);
            }
    
    The bd.Initialize() method simply goes off and adds entities to the dbcontext and does a save. A couple of snippets from base data are
    
      public void Initialise()
            {
                InitialseAudit();
                InitialiseSecurity();
                InitialiseCategories();
                InitialiseGoals();
                _dbContext.SaveChanges();
            }   
    
      private void InitialiseCategories()
            {
                var workCategory = new Category { Id = (int)CategoryEnum.Work, Name = "Work" };
                _dbContext.Categories.Add(workCategory);
                var homeCategory = new Category { Id = (int)CategoryEnum.Home, Name = "Home" };
                _dbContext.Categories.Add(homeCategory);
            }
    
    
    I have also used enums for the primary keys that I am interested in. This way they are really easy to reference and reuse in teh system and the tests. Usage would be something like the following, this is just as an rudimentary example of saving a goal to a list for a user.
            public GoalServiceShould()
            {       
                var testSetup = new TestSetup();    
    
    
                var dataContext = testSetup.GetDataContext();
                _uow = new UnitOfWork(dataContext);
                _goalRepository = new Repository(dataContext);
                
                _goalService = new GoalService(_uow, _goalRepository);
            }
    
            [Fact]
            public async void AddNewGoal()
            {
                var stamp = DateTime.Now;
                var goal = new GoalDto
                {
                    UserId = 1,
                    Note = $"New Note {stamp}",
                    DueDate = new DateTime(2017, 1, 6),
                    Urgent = true,
                    ModifiedById = 1
                };
                var returnedGoal = (await _goalService.SaveGoal(goal)).Content;
                returnedGoal.Id.ShouldBeGreaterThan(0);
    
                var savedGoal = await _goalRepository.GetAsync(p => p.Id == returnedGoal.Id);
                savedGoal.Note.ShouldBe($"New Note {stamp}");           
            }
    
    
    I could share a full example if anybody is interested, send me a message or leave a comment and I will get back to you. I am using Shouldly for the asserts in the test.
  • Management

    A couple of months ago I was handed the reigns of the development team at RMSS. Since then I have interviewed and hired a new guy and have got two major projects on the go and have started a little bit of training and knowledge sharing after our scrum meetings a couple of times a week. What is interesting is that all is going pretty much as I expected except that I can't seem to leave work at work. I never have been able to really, if I had a problem to fix, a bit of architecture that I was nutting out in my mind I would go over and over it until I had a solution to all the intricacies of the problem and done a mental cost/benefit analysis to see if it made sense. For example last year I had to come up with a scheduler that would return appointments or jobs and their status for a given period of time. I thought about the problem and implemented it over a couple of weeks. There was one particular issue that bugged me for a few days, I didn't get the solution until I had left work and was riding my motorbike home when the solution came to me.  Another solution came while I was eating breakfast.

    I still do that but now I have to worry about my team, is everyone happy, how they are all going, what I can do to make us more productive, enjoy our work better etc. etc. It is early days in this management role, I think things are going well, this week each member of the team is going to present an element of SOLID design after our scrum meeting. When I said we were going to do this I got a mixed response but I guess we will wait and see how it all works out and if the team put much effort into presenting to their peers. I hope so. I would really like to see us all looking for innovative ways to solve problems, to have a toolbox full of patterns and principles we can draw on everyday to solve programming problems.

    It is an exciting time, So far I like this gig. The hands on manager thing seems to be fitting me pretty well.
  • Fluent Validation Framework


    Over the last week I have been playing around with the fluent validation framework on codeplex.
    The reason I have been using it is because I needed a validation framework that I could easily construct rules with and change over time. For example, an order does not require payment details until the user is checking out, so as the state of the order is changing from adding items, to purchasing items to printing the receipt, the requirements for validation against the order object are as well! Being able to construct the validation using predicates on the validation call makes this process easy.

    The framework allows chaining of rules, nesting of object validators and custom validators should you need them, I find it much more practical than attribute based validation on object properties that have no concept of state, and easier to maintain and define than using XML in the Enterprise library.

    So for me it is an excellent solution giving the flexibility I need using generics and predicates in a very practical way
  • Click once application wont start


    I could not beleive it when i figured out why a click once application would not start on one of the networks machines. Over the past few days I have been helping a few people install our main business application from click once rather than over the network as it has been for the last 12 months, All was going well except for one machine. I tried reinstalling .NET 2.0 framework and going through the registry looking for any references that may have been left behind but to no avail.

    Our user naming convention is firstname and first letter of last name, this one particular users account was firstname.lastname noticing this I logged on using my domain account and sure enough my clickonce started working properly.

    So it seems having a full stop in the login username causes the software to fail with this mesage
    The system cannot find the path specified. (Exception from HRESULT: 0x80070003)

    Crazy I know. but true.
  • Provider Model


    A month ago we had a new architect start at work the guy is crazy about the provider model here is a code project implementation

    http://www.codeproject.com/KB/dotnet/ConfigAndProviderModel.aspx

    So this has got me thinking about enterprise application patterns I might need to use sometime. Fowlers book "Patterns of enterprise application architecture" seems to be the book to read, every time I look up patterns for enterprise coding, this book is usually mentioned, I guess I will have fast track it into my schedule, that is the same schedule that has to fit in all the MCTS and an MSCP that we are all studing for work so we can become a Microsoft gold partner shop.

    Its nuts really how as I learn more the bigger my "todo" and "have to learn about" lists get, it looks like it will be next year before I even get a chance to look at doing a decent case study/ implementation of WPF or WF, I do have a WCF project just around the corner so that will be nice to finally have a play with.

    Thinking about it I have close to 5000 pages of text to read half being books i want to read and the other half Microsoft cerifications, I wish someone could invent a matrix like brain data dump so I dont have to queue nightly tech reading for the next 6 to 12 months depending on my disposition and my daughters sleeping habits. arrrrrgghh
  • Gang of four

    So it seems if you want to call yourself an OO architect you need to have read a particular book "Elements of Reusable Object-Oriented Software" it's referred to as gang of four because of the four authors that wrote it. From what I understand it was a pretty big move to bring patterns note ably OO ones and give them names and documents them. using these we can communicate our ideas on how to solve problems more effectively, and gives us ideas of how to solve problems we face in our architecture. I started reading it yesterday, after its finished I will start Martin Fowler's "Patterns of Enterprise application architecture. Then Jimmy Nilson's Applying Domain Driven Designs and Patterns". Hopefully then I will have some good ideas to build my next project.
  • If you've gotten this far...

    Thanks for checking out my site, get in contact below if you would like to chat.

    Located

    Brisbane, Australia

    Email

    rmcnichol@gmail.com