The Cloud One Blog

How to

Posted by admin on Monday, February 6, 2017

How to disable Identity for int primary keys in Code-First

EF Code-First uses conventions to beautifully create identity field for us when defining int primary keys. However, there are times that we don't want the database generate the primary key values for us. Here are two ways to avoid Code-First set identity fields on int primary keys.

Read this post

Posted by admin on Wednesday, February 1, 2017

How to convert Excel to PDF without extra margins

Seems it a very common problem from Excel (and sometimes Power Point) that you set all correct, nice margins, adjust columns to fit into the printing area, in preview looks fine, you save as (or print as) PDF, and then... your find out extra margins on the left and right!!!

Read this post

Posted by admin on Monday, June 27, 2011

.NET MVC3, how to avoid session restart in 100 MB application pool

We recently had some problems with one our host servers, they set a limitation of 100 MB memory for dedicated application pools. While is understandable they set such a limit, problem is that limit is very low for .net mvc websites, since an empty website already needs 30 MB, so as soon as you add database and get traffic, it easy goes above 100 MB, causing the application pool to restart and session is lost having all your visitors logged out.

Read this post

Posted by admin on Saturday, June 18, 2011

How to define ntext fields using Code-First in .NET MVC3 and SQL CE4

When defining our model using POCO classes, we just use string for all our string model properties that later are created as nvarchar fields in the database. String types max length is 4,000 characters, so, what if I need something longer, for example for a blog content field? Then, we need ntext.

Read this post