Archive for the ‘.Net’ Category

Using aggregate functions SUM and COUNT together in one LINQ query

Today, I needed to use more then one aggregate function together in one LINQ query and I did a brief search in the internet. I found some sites that can be useful but not really a sample for my case. One of the nice web sites with samples is 101 LINQ Samples. It contains samples [...]

{"Server-generated keys and server-generated values are not supported by SQL Server Compact."}

I’m creating a small application for my friends and I decided to use SQL CE and Entity Framework. I’ve configured the database to use identities for primary keys in tables and I got an exception when I’ve tried to add a record.
According to information from internet Entity Framework doesn’t support database generated values. It [...]

XmlConverter performance improvement

Last year I wrote a post about how to serialize and desterilize objects to/from XML using standard .Net Framework classes (see this post).  Yesterday, I need to use the class but I need to improve the performance. When one creates XmlSerializer class many time is spend to configure it behind the scene. After its initialization [...]

Think twice before to implement some idea – # 1

I’ve already written some posts that show some source code that can be rewritten in a different way and this way to achieve better performance. Now I will open a series with a topic of this post with a number and I’ll post different samples of implementations that I’ll run into and I’ll do some [...]

is operator + object casting or as operator + null comparison?

This week I found in the source code of one of our projects that people use “is” operator + object casting in places that they can use “as” operator + null comparison.

1: // "is" operator + object casting

2: if (myObj is MyObject)

3: {

4: [...]

Windows Installer vs. ClickOnce Deployment

Today, one of the developers in our teams asked me does it possible to use custom actions in ClickOnce. I’ve never thought about this before and I googled a bit. I found a nice article in MSDN. It briefly describes both technologies and the beginning and you can get an overview of them. Further, it [...]