Since I’ve been developing software again, I’ve had to sharpen my skills on the latest enterprise architecture patterns and how they are used in .NET. The Repository and UnitOfWork patterns aren’t new, but implementing them correctly to achieve the most benefit without going overboard is nevertheless a learning curve. I found a presentation posted on YouTube by Mosh Hamedani that demonstrates implementing the Repository and UnitOfWork patterns using Entity Framework 6. (This video is part of a larger course he’s developed.)
I like his approach very much. Some of the plumbing work can easily be abstracted into a class library. I am sure many developers have done this already, but this was part of my learning. I had also never published a NuGet package. I figured if I wanted to manage dependencies in my own projects, it wouldn’t hurt to set that up. Because the library isn’t particularly advanced, I see no need to keep it private. So, I published my first package to the NuGet Gallery. I wasn’t expecting anyone else to stumble across that, but some did and wanted to use it.
I am encouraged by that and will continue to publish updates to NuGet. Note that at this time, I don’t have a public source code repository for this but I understand that that’s important to many. I will get the code up on GitHub sometime soon though.
A group in Office 365 (link to a Sway) is a very useful concept: it allows any user to quickly create a shared mailbox, document repository, OneNote notebook and shared Calendar. Compared to a Team Site, it’s quick to set up and requires no special privileges. (That does create some potential governance issues, but I am not going to dwell on that in this post.)
Based on the URL format, a group becomes a Team Site “lite.” Unfortunately, there are some aspects of Team Sites that I like better than groups and vice versa. So here is what I wish Microsoft would do:
- If the “group” becomes some permanent fixture of the organization (some organizations would say “task force” versus “committee,” etc.), it could be useful to allow a group to be converted to a Team Site so additional apps can be added.
- The functionality of subscribing every member of a Team Site to a Site Mailbox would be an excellent option.
- The functionality of subscribing to the OneDrive space of a Group, like you can create alerts on Document Libraries, would be excellent to add to Groups.
I will add that I am anxiously anticipating the release of Planner, which is of course, a Groups feature.
I’ve recently started using Visual Studio 2015 quite extensively for a development project. Overall, my impression of the latest release is favorable. It feels snappier than older versions and the touch of color that’s been brought back compared to 2012 is most welcome.
However, I have run into an issue I believe is new to version 2015. Once in a while, a coworker or I will add a file to a project and Team Foundation Services will immediately mark the file as “checked in.” I am sure there are certain conditions under which this happens, but I haven’t determined what those are. The file of course is not checked in, VS 2015 just thinks it is. The file will not show up in the Pending Changes view. Moreover, attempting to edit or delete the file and then perform a check-in also won’t work. TFS/VS mark the file for edit or delete, but then conclude that the file doesn’t exist in the source control database and fail the check-in.
Other symptoms of this may be hard to spot. If you’ve got a large check-in, you likely won’t notice this the file isn’t in the Pending Changes list until a co-workers tells you you “broke the build.” That’s because the file will be missing from their project even after they get the latest version. You won’t see the file in Source Control Explorer, even on the machine where the file exists.
The solution fortunately is rather simple: select the file in Solution Explorer and click the Refresh icon at the top of Solution Explorer. This will get Visual Studio to realize that the file is in fact not checked in. It will instead mark the file as not under source control (you can tell because there will not be any source control icon next to it). Now, you can right-click on the file and select “Add file to source control.” The file when then be marked as “Add” and you can check-in your changeset as usual.
In about one month, on October 3, 2015, make plans to attend this free, one-day SQL Server event. Not only can you pick up some new SQL skills or refresh existing ones, it’s also a great network opportunity. Troy University is also proud of its new facility on the banks of the Chattahoochee River, dubbed the Riverfront Campus.
Speaker selections have not been finalized yet, but I expect to present at least one session in addition to volunteering for the event. I hope to see you there!
I’ve started a new software development project recently, and the entire solution will be hosted on Azure PaaS resources, including Web Apps. Part of application development involves storing configuration settings for the application. Notably, this could include the database connection string(s). In the case of the app under development, there are Azure Active Directory, Azure Key Vault and Azure Storage Account settings (to name but a few).
Over the years, storing configuration settings in web.config has been a common practice. Visual Studio enhancements in recent versions, especially Web.config transformation, have made web.config deployment to different environments (such as test, QA, staging and production) also much easier.
On Azure, things get especially interesting though. In addition to the many settings for the different Azure resources, the concept of deployment slots on a Web App allow for different versions of the code to run in a single VM. This is useful for test, QA, A+B testing, etc. However, you might very well have the same Visual Studio build configuration for code that lives in different deployment slots.
On top of that, there are some settings that will keep the same values across deployment slots (for example, your database connection string would not change for A+B testing), but will change for other deployment slots. You’d quickly end up with an exponentially growing number of Web.config transformation files and the added risk of accidentally deploying an incorrect build configuration to a particular slot.
So, instead of trying to create Web.config transformation files for every combination of settings, you would instead add your connection string(s) and app setting values to the Azure Portal UI. This will not actually update the values in web.config, but using the standard ConfigurationManager API, will cause those values to be used instead of those found in web.config. Don’t worry, you don’t need to specify all app settings keys in the Azure Portal. Add only those you care to have Azure change for you based on the deployment slot.
In addition to being very convenient, there are also security benefits, as described in this post:
A full walk-through of creating deployment slots and how configuration settings can swap or “stick” to deployment slots, see this tutorial:
Yesterday, I spoke to the Steel City SQL User group on T-SQL window functions. Below is a short summary and links to the sample scripts and database.
The T-SQL window functions came about in SQL Server 2005, but you really want SQL Server 2012, because many functions were added and also because support for PARTITION BY was introduced only in 2012.
The basic script below does a good job demonstrating each function with very small data sets in temporary tables. This makes it easy to examine the output. For larger examples, I used two real-world data sets: domestic flight data from October and November 2014 (about 1 million rows) and course section data from Troy University. The flight data is available for download (caution: large file), but I can’t make the course section data available.
The functions that I focused on during my presentation were
- RANK, PERCENT_RANK and DENSE_RANK
- LAG and LEAD
I briefly showed the other window functions also, like CUME_DIST, PERCENTILE_CONT, etc. Some of the sample scripts also include turning SUM and COUNT into window functions instead of aggregate functions (i.e no GROUP BY required).
Here are the downloads (hosted on OneDrive):
Here is a summary of my session, at 3 PM in “Room 2” (that just sounds too easy…)
Of course, you really want to sign up for the other speakers, but just maybe at 3 PM my session will appeal to you.
P.S.: Bring your family to Mobile! Tomorrow they can get free admission to the USS Alabama and Battleship Memorial Park.
Windows Server 2012 R2 High Availability for SQL Server
After presenting this session a few times, I now know to make sure attendees a clear from the beginning that this is a Windows-focused session! With the increasing adoption rate of virtualization, creating SQL Server clusters is now within reach of many more DBAs. What do you need to know about Windows Server 2012 (R2) virtualization and high availability to set up your first cluster? Come learn from a Windows Server admin and (accidental) DBA who’s been building SQL Server clusters since 2000 (the year and the version!). We’ll discuss initial planning, the process and the maintenance best practices. There will be demos too, so if you want to see a multi-node SQL cluster run on a Lenovo X230 tablet, come see (it’s pretty cool!).