Managing the configuration data have always been troublsome. Although Microsoft did provided and also updated/upgraded a lot of options from time to time, yet it remains a challenge most of time. Things get more critical when the configuration data we are concerned is the confidential data like connection string, smtp passwords, API keys etc becase at some point of time, they do get checked in source code or shared across other developers. In one of my prev project faced a similar issue when private key and the Code Signing certificate was accidentally checked in by a developer. The customer had to revoke the certificate which invalidated all the production builds which were deployed to end users as well. Continue reading “Using the configuration Builder in ASP.NET 5”
IEnumerable doesn’t support this. This is by design.
IEnumerable uses lazy evaluation to get the elements you ask for just before you need them.
If you want to know the number of items without iterating over them you can use
ICollection<T>, it has a
ICollection<T> c = source as ICollection<TSource>;
if (c != null)
int result = 0;
using (IEnumerator<T> enumerator = source.GetEnumerator())
Using a SQL Database in the cloud can be useful. You get a completely managed database without any prior configuration. It scales well and can be used from within your cloud or onpremise applications. Continue reading “Handling exceptions by using retries (SQL Database)”
EF 4.1 introduces two new features
- The DbContext API is a simplified abstraction over ObjectContext and a number of other types
- Code First is a new development pattern that provides an alternative to the Database First and Model First patterns
Code First is focused around defining your model using .NET classes. These classes can then be mapped to an existing database or be used to generate a database schema. Additional configuration can be supplied using Data Annotations or via a fluent API. Continue reading “How to create a Code-First EF model”
This article describes a method to automatically copy data from an object to another object with similar structures. This is similar to a
deep_copy(source, destination) but with the possibility of returning a type that is different from the source.
I needed a way to apply/convert values from one object to another so I created a method to automatically drill down the source object graph and copy the properties from one object to another. There are many ways to do this, but I designed a method that is generic enough and also leaves place for customization/fine tuning/hacking. Continue reading “Method to Copy Data Between Objects of Different Types”
If you have had a play with the awesome Code generation tool that you can build yourself:
Walkthrough: Generating Code by using Text Templates
Then you might have had a small issue with the above error:
A template containing a class feature must end with a class feature
The error is caused by an invisible space after the last #>
It is also important to bear in mind, that invisible spaces may cause other hard-to-understand compile-errors.
If you want to see a bigger picture, just look at following links:
Now that you are aware how harmfull invisible spaces can be when dealing with Text Templates, my advice is: Make them visible. If you don’t know how to do it, see Jeef Widmer’s blog
ASP.NET and IIS scale very well, but you’ll need to change a few settings to set up your server for lots of concurrent connections, as opposed to lots of requests per second. Continue reading “Performance tuning IIS for multiple concurrent threads”