How to sign third party assemblies
You need to sign assemblies if you want to put them in the GAC.
If you sign an executable, then any class libraries it links to also needs to be signed. This can be difficult if you’re using a third-party library.A very important reason to sign an assembly is so you can be sure it is your assembly. Since the private key is yours, nobody else can sign an assembly with that same key. This means that when the public key of an assembly is one you know.
Continue reading “How to sign third party assemblies”
Microsoft CacheManager Contains vs Getdata
In Microsoft.Practices.EnterpriseLibrary.Caching, GetData is used to get data from the cache and Contains checks whether the key exists in the cache. Ideally if Contains(key) returns true than GetData(key) should returns data from the cache associated with the key. But somehow it works in the different condition. In the below code block Contains(key) returns true but the block returns null.
Before returning the cached value, the GetData method performs a check to see if the CacheItem has expired. If it has expired, the CacheItem is removed from the cache and null is returned. However, the call to Contains will return true because the CacheItem is in the cache even though it’s expiration may have elapsed. This seems to be by design. With that in mind, it would be wise not to cache a null value to represent no data since you would not be able to discern an expired CacheItem from an actual cached value of null.
Continue reading “Microsoft CacheManager Contains vs Getdata”
SQL naming conventions
This article is for standards for the SQL naming convention. I listed all basic which I found useful. May this will benefit you too.
Databases and Files
- The database name should accurately reflect the database content and function. Use the Pascal case structure for database names. E.g., Northwind
- Use both upper and lower case letters as appropriate. Do not use spaces or underscores in the name
- File names must match the database name
Continue reading “SQL naming conventions”
C# Coding Standards
General Naming Conventions
Following a consistent set of naming conventions can be a major contribution to readability. Beyond consistency of form, names of application and framework elements must be easily understood and must convey the functions of each element.
It is important that the names of identifiers make sense on the first reading. Identifier names should clearly state what each member does and what each type and parameter represents. To this end, it is more important that the name be clear than that it be short. Names should correspond to scenarios, logical or physical parts of the system, and well-known concepts rather than to technologies or architecture.
Do choose easily readable identifier names. For example, a property named HorizontalAlignment is more readable in English than AlignmentHorizontal.
Do favour readability over brevity. The property name CanScrollHorizontally is better than ScrollableX (an obscure reference to the X-axis).
Continue reading “C# Coding Standards”
How to Format SQL query?
While working on SQL queries especially when one is dealing is large lines of SQL code , in that case formatted and refracted query is a live savior. In this blog I’II provide you with the solution which I found quite useful.
#Formatting SQL query using SSMS
This is for the guys who regularly have to deal with the queries. There is no built in formatting in SSMS (SQL Server Management Studio) although Ctrl + Shift + Q will give you a Query Designer window from which you can copy formatted query but there are plugins available that will integrate with SSMS. There are a million others out there but not all of them that do plug into management studio, but the one I know of and it works very well is Apex SQL Refactor. It is a free plugin. Integrates with SSMS. Downside is that it is an all or nothing process. It does not refactor as you type. For complete Installation Guide of Apex SQL Refactor, you may refer this.
#Formatting SQL query using Online Tool
This is one of the quick solution if you don’t have any plugin or you don’t want to as you may not have to deal more with SQL queries, there are tools that will do formatting for you. Again guys there are many online free tools available that you can use to format your large queries. One of my favorite is SQL-Format because apart from formatting it will give you many option, desktop version for this is also available but I prefer to better save my PC storage and do it online.