I’m sure there are millions of blog posts out there that already discuss this but I think its worth noting down even if its just something for me to remember.
Store your datetimes in UTC format into the database. Unfortunately this mean executing something like:
myObject.ExpiryDate = TimeZoneInfo.ConvertTimeToUtc(dateTime, TimeZoneInfo.FindSystemTimeZoneById(“timezoneid of users”)
In every central place where you update/insert DateTime values on your objects you will need the above.
When you display any DateTime information it must display as a local datetime value. You can do this by using
For those of you that don’t know what Markdown is, its essentially a shorter/cleaner syntax that can be parsed to produce HTML. Below are a few examples:
#Hello World! ## You're awesome! The quick brown fox jumped over the lazy coder What the **hell** is this? This is an [example link](http://example.com/) <h1>Hello World!</h1> <h2>You're awesome!</h2> <p>The quick brown fox jumped over the lazy coder</p> What the <strong>hell</strong> is this? This is an <a href="http://example.com/"> example link</a>
You can see more examples in the earlier link.
When you’re writing a blog post or a lengthy page in your web app with lots of HTML it maybe easier to use Markdown as your preferred syntax. I currently use WordPress for my blog, it’s ok but its quite bloated for probably what I need. I looked into Calepin and Scriptogr.am as alternative blogging platforms but I felt it didn’t quite offer what I wanted but the approach was a good idea. It meant you could write a blog post and simply put the file in dropbox and it would appear on your blog.
As a C# developer I think I’m pretty safe in saying that its not going away any time soon however, its my opinion that to not become irrelevant you need to have options. Some may argue that its better to be master of one than a Jack of all trades but lets just say you can’t find your next job in the primary language you want to work in. What do you do?
I recently had a need to look into using Entity Framework (EF) for a ASP.NET MVC project. In the past I have always used PetaPoco as my ORM of choice and with hearing nothing but bad things about EF I was a little sceptical. There are various ways to use EF, Code First being one of them and the easiest from what I can gather and luckily the approach I needed to get up to speed on. This means you can define your model in code and EF will turn that into tables in your database.
The way I was going to see how EF could be architected in an application was to create a MVC application that provided CRUD capabilities for Customers, Orders and Products. Nothing complicated but something enough to see how EF could be fitted in with a MVC application. I would also like to use a unit of work pattern such as instantiate a model class, set some properties and call a save method. I would also like to keep the architecture well enough abstracted so that another ORM could take its place easily enough if needs be.
I will list the various approaches I took investigating the how EF could be integrated. They are not in any chronological order.
Before I actually looked at these two I spent some time with SammyJS but realised afterwards it was mainly MVC based and not around 2-way binding that Knockout and Angular offer. However, I really liked it and it seemed very familiar and easy to use, the reason being it was inspired by Sinatra which we all know Nancy was also inspired by and we also know how much I like Nancy!
In this blog post I will focus on what I found when using KnockoutJS.
Firstly Knockout should be commended on their documentation and online tutorials. Their website tutorials follows a step by step approach and once you have completed each step you can click through to the next section. You can also leave the tutorial and come back to it and it will remember where you left. There is great support in the KnockoutJS room in Jabbr and I’d like to thank David Spörri for answering my newbie JS and Knockout questions.