In making the switch to ASP.NET MVC, I’ve moved away from using my old Data Access Layer that I’ve used for years and have opted to use Dapper as my ORM of choice in the quest for optimal performance. My DAL was actually pretty optimized for WinForms and WebForms (using straight SQL Queries and SQL parameters) but mapping it to models wasn’t something I had in mind when I created it. I’m finding Dapper takes some getting used too but it is still pretty fast. The downside is that writing the code for Models to wire it up is proving to be a little tedious.
To that effect, I wrote a little application that has helped me generate the models from a database dynamically. It’s in it’s infancy stages and something I cobbled together in less than 8 hours but it works. I’ll add more features too as time goes on if there’s enough interest or to satisfy my own needs. In the meantime, I’m open sourcing the project as it may help others and I’d love to see it become something grander if others are willing to contribute to it. There’s also some useful bits of code that others may find useful to reference like dynamically reading fields from a database, pluralization/singularization of words, amongst others.
You can find the repository on Github: https://github.com/gregvarghese/MVCModelGenerator
I’ve recently started using Git for development and while I am getting used to the command line tools on Windows, I have been using Atlassian’s free tool, SourceTree to help manage my code. Recently I’ve run into an issue where SourceTree crashes on start up.”Oh dear. We’re sorry, but SourceTree just crashed. How terribly embarrassing.”
I submitted an issue (https://jira.atlassian.com/browse/SRCTREEWIN-3011) and received a response that didn’t solve the issue. I submitted a follow up but never heard back so I did some further digging and found that SourceTree was crashing because it corrupted a repo and was still trying to load it back up on start up. The application does not exit gracefully or even give you the option to start in a safe mode which loads nothing.
To prevent it from opening the repo on start up:
Open %localappdata%/Atlassian/SourceTree/opentabs.xml in notepad or another editor.
Delete the problem repo.
Viola! No more SourceTree crashes on start up.
In working on implementing a Sitecore site into an existing code base inherited from another vendor, I discovered that the admin password had been modified and the vendor would not share it. Not being able to login to the admin section of Sitecore was not ideal to say the least. After scouring the web, most articles contained instructions on how to reset the password, but almost all of them applied to Sitecore 6 and below. For Sitecore 7 and above, most articles were not applicable as they introduced the PasswordSalt field into the database which Sitecore uses to hash the password.
If you’ve run into a similar situation, or you’ve forgotten or lost your admin account password, getting access back to everything is pretty simple. Load SQL Management (or your favorite SQL editor) and execute this query against your Core database:
SET [Password]=’qOvF8m8F2IcWMvfOBjJYHmfLABc=’, [PasswordSalt]=’OM5gu45RQuJ76itRvkSPFw==’, [IsApproved] = ‘1’, [IsLockedOut] = ‘0’
WHERE UserId IN (SELECT UserId FROM dbo.aspnet_Users WHERE UserName = ‘sitecore\Admin’)
This will now reset the default admin password to ‘b’ so that you may login to the Sitecore desktop. Happy editing!