Thursday, July 31, 2014

EF Code First: Create table out of Enum

Imagine you have a number of enums in your code. They are defining static data and you want those enums to be mirrored in database as tables with appropriate data. Here is the tip how to quickly map enums to your tables and to seed them with enum values.

Wednesday, July 30, 2014

Entity Framework Code First: Custom data context initializer

While working with Entity Framework Code First at some point you will probably decide to create custom database initializer which allow you to create/recreate database based on flag in configuration file and automatically seed this database with data, stored procedures, views etc.

Saturday, July 26, 2014

How does WebActivator work?

WebActivator allows to execute some code before application starts (or when it's shutting down). Which becomes really useful when you are making your own packages and you want your package to do some actions when application starts/shuts down. And the person who will use your package does not need to do those actions manually.

Let’s look at the features of WebActivator and get inside the source code to see how it works and what does it mean when you meet in code something like:

[assembly: WebActivator.PreApplicationStartMethod(typeof(SomeClass), "SomeMethod", Order=1]
First of all lets look at the WebActivator structure.

Saturday, July 19, 2014

Tip: skype chat commands

Recently I discovered the fact that Skype has a bunch of useful chat commands which can save time clicking around UI and overall come in handy.

Those should be used in latest Skype version and can be typed as a message, no one else will see it except you.

/get uri for example will return you an url that others can use to join the group conversation.

/remotelogout will sign out all other instances except the current one. Ain't it useful to log off Skype you left open at work? :)

/showplaces will show all the other instances where this Skype name is currently signed in.

/alertson and /alertsoff will enable/disable message notifications for current chat. By the way enabling notifications can be used with filter /alertson [text] specifying text which should appear in chat to trigger notification.

Complete list of commands can be found here or simply type /help in chat and it will give you the same link.

Thursday, July 3, 2014

Tip: Using syntax highlighter

I know i should've used this amazing SyntaxHighlighter (many thanks to the developer!) from the very beginning, but for some reason i got to it only now. So here is my quick glance on this beautiful product. :)