Skip to main content

Posts

Testing NULL values with Powershell

When a developer has to do an IT pro job, he does what he knows best: writing code. So I started with writing some powershell scripts to automate some administrator jobs. One thing you may not forget is that Powershell is a lot more friendly for NULL values than C#, so don’t forget to check your objects for NULL values. In Powershell this is very clean and easy to do. To see if a variable is null, simply check: 1: If (!$Variable) {some action} Conversely, to verify if the variable has any value:   1: If ($Variable) {some action}

IIS Express: Combining the best of ASP.NET development Server and IIS

As a .NET developer I normally run and debug my ASP.NET (MVC) sites and WCF services using one of two web-servers: The ASP.NET Development Server that comes built-into Visual Studio The IIS Web Server that comes built-into Windows Both of the above options have their pros and cons, the ASP.NET Development Server is very easy to use, where IIS has a lot more power and features.  Today Scott Guthrie announced a new, free option – IIS Express - that combines the best characteristics of both. IIS Express will work with VS 2010 and Visual Web Developer 2010 Express, will run on Windows XP and higher systems, does not require an administrator account, and does not require any code changes to use.  You will be able to take advantage of it with all types of ASP.NET applications, and it enables you to develop using a full IIS 7.x feature-set. Read more about it in Scott’s post: http://weblogs.asp.net/scottgu/archive/2010/06/28/introducing-iis-express.aspx

SQL Server: Showing a list of open database connections

Today I wanted to drop a specific database, but their was one account still connected. I had no idea who was still using the database, so I needed a way to get the list of open database connections. There are 2 commands that helped me out here: sp_who sp_who2 The sp_who internal procedure allows users to view current activity on the database. This command provides a view into several system tables (e.g., syslocks, sysprocesses, etc.). The sp_who command returns the following information: Spid—The system process ID. status—The status of the process (e.g., RUNNABLE, SLEEPING). loginame—Login name of the user. hostname—Machine name of the user. blk—If the process is getting blocked, this value is the SPID of the blocking process. dbname—Name of database the process is using. Cmd—The command currently being executed (e.g., SELECT, INSERT) The sp_who2 internal procedure provides the above information, but also provides the following additional in...

Community Day session: Building an enterprise application with Silverlight and NHibernate

At Community Day 2010, together with Gill Cleeren, I gave a session called Building an enterprise application with Silverlight and NHibernate. We not only showed Silverlight and NHibernate but also looked into topics like CQRS(Command-Query Responsibility Seggregation), OData, MVVM, and so on. Building an enterprise app in silverlight 4 and NHibernate View more presentations from bwullems . Our demo application had a lot more features than we could show, so certainly have a look at the code .

OData: Using the reflection based provider

If you start implementing WCF Data Services, sooner or later you will certainly see following error when calling the OData feed: “On data context type 'XXXXX’, there is a top IQueryable property 'XXXX' whose element type is not an entity type. Make sure that the IQueryable property is of entity type or specify the IgnoreProperties attribute on the data context type to ignore this property.” This can mean two things. Either you have a property that cannot be processed by the Entity Data Model used by OData or OData could not find a primary key for your class. OData requires a primary key for every resource. If you use the reflection based provider, it uses one of the following mechanisms to find the primary key: via the [DataServiceKey] attribute by looking for a "FooID" property, where the type is called "Foo" by looking for an "ID" property Important to know is that this convention is case-sensitive: "FooId" won't work without...