14. January 2017 05:01
If you mistakenly happen to set the start up page in visual studio for asp.net mvc application, you may remove start up page in project properties "Specific Page" as follows-
If you receive following error - change project Target Framework to 4.5.1.
One or more errors occurred while processing template 'Entity.tt'.
error : An exception was thrown while trying to compile the transformation code. The following Exception was thrown:
System.ArgumentException: Empty path name is not legal.
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
at System.IO.File.OpenRead(String path)
at Roslyn.Utilities.FileUtilities.OpenFileStream(String path)
at Microsoft.CodeAnalysis.MetadataReference.CreateFromFile(String path, MetadataReferenceProperties properties, DocumentationProvider documentation)
at Microsoft.VisualStudio.TextTemplating.CompilerBridge.<>c.<.ctor>b__15_0(String x)
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at System.Collections.Immutable.ImmutableArray.CreateRange[T](IEnumerable`1 items)
at Microsoft.CodeAnalysis.ImmutableArrayExtensions.AsImmutableOrEmpty[T](IEnumerable`1 items)
at Microsoft.CodeAnalysis.Compilation.ValidateReferences[T](IEnumerable`1 references)
at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.WithReferences(IEnumerable`1 references)
at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.CommonWithReferences(IEnumerable`1 newReferences)
at Microsoft.VisualStudio.TextTemplating.TransformationRunner.Compile(String source, String inputFile, IEnumerable`1 references, Boolean debug, SupportedLanguage language, String compilerOptions)
EF power tool downloadable from here
currently are not compatible with VS 2015. To make it compatible perform following steps-
2. Rename file EFPowerTools.vsix to .zip
3. Open extension.vsixmanifest file and add following
4. Save changes and Rename file to .vsix
5. Install tool
You should now be able to see the Entity Framework option on right click of your project.
Hope this helps
5. October 2015 07:10
Estimating the Size of a Table
The following steps can be used to estimate the amount of space required to store the data in a table:
- Specify the number of rows present in the table:
Number of rows in the table = Num_Rows
- If there are fixed-length and variable-length columns in the table definition, calculate the space that each of these groups of columns occupies within the data row. The size of a column depends on the data type and length specification. For more information, see Data Types.
Number of columns = Num_Cols
Sum of bytes in all fixed-length columns = Fixed_Data_Size
Number of variable-length columns = Num_Variable_Cols
Maximum size of all variable-length columns = Max_Var_Size
- If there are fixed-length columns in the table, a portion of the row, known as the null bitmap, is reserved to manage column nullability. Calculate its size:
Null Bitmap (Null_Bitmap) = 2 + (( Num_Cols + 7) / 8 )
Only the integer portion of the above expression should be used; discard any remainder.
- If there are variable-length columns in the table, determine how much space is used to store the columns within the row:
Total size of variable-length columns (Variable_Data_Size) = 2 + (Num_Variable_Cols x 2) + Max_Var_Size
If there are no variable-length columns, set Variable_Data_Size to 0.
This formula assumes that all variable-length columns are 100 percent full. If you anticipate that a lower percentage of the variable-length column storage space will be used, you can adjust the result by that percentage to yield a more accurate estimate of the overall table size.
- Calculate the row size:
Total row size (Row_Size) = Fixed_Data_Size + Variable_Data_Size + Null_Bitmap +4
The final value of 4 represents the data row header.
- Calculate the number of rows per page (8096 free bytes per page):
Number of rows per page (Rows_Per_Page) = ( 8096 ) / (Row_Size + 2)
Because rows do not span pages, the number of rows per page should be rounded down to the nearest whole row.
- If a clustered index is to be created on the table, calculate the number of reserved free rows per page, based on the fill factor specified. For more information, see Fill Factor. If no clustered index is to be created, specify Fill_Factor as 100.
Number of free rows per page (Free_Rows_Per_Page) = 8096 x ((100 - Fill_Factor) / 100) / (Row_Size + 2)
The fill factor used in the calculation is an integer value rather than a percentage.
Because rows do not span pages, the number of rows per page should be rounded down to the nearest whole row. As the fill factor grows, more data will be stored on each page and there will be fewer pages.
- Calculate the number of pages required to store all the rows:
Number of pages (Num_Pages) = Num_Rows / (Rows_Per_Page - Free_Rows_Per_Page)
The number of pages estimated should be rounded up to the nearest whole page.
- Calculate the amount of space required to store the data in a table (8192 total bytes per page):
Table size (bytes) = 8192 x Num_Pages
After configuring the custom section with help of IApplication interface in Umbraco, you must have faced issue with custom section name decorated with square brackets. This issue occurs due to the translations (language) being missing in config file for custom section name.
Problem - Remove square brackets from custom section name-
Soultion - Goto Umbraco\Config\Lang folder in your umbraco project
In en.xml file, under sections area - add key with alias magic and provide a relevant name as shown below-
Done square brackets are removed and replaced with custom description. Check out-
Hope this helps.
How to install Umbraco 7+ in visual studio 2012/13 using nuget package
1. Create a blank Web application using visual studio
2. Open package manager console. Select appropriate project(web application) and hit command
Install-Package UmbracoCms -Version 7.2.6
At the time of writing this post Umbraco 7.2.6 was the latest version.
3. Done- Umbraco is installed. All binaries and config files are automatically included in project.
4. Run web application and Umbraco site setup details are asked.
25. June 2015 16:06
Consider if you want to use if and only if condition (IIF) with a nullable type
foo = true ? null : new DateTime(0);
This will throw a compiler error. To resolve this cast null to nullable type as below-
foo = true ? (DateTime?)null : new DateTime(0);
24. June 2015 15:06
for more info.
23. June 2015 15:06
This are some of the LINQ syntax for immediate query execution (more to add)-
3. Aggregate Methods (like Count(), Sum() etc.)
As I said there are more to add, will keep updating as and when I find more methods.
To group .net projects in visual studio create Solution Folder
Right Click Solution --> select Add option --> select New Solution Folder
Add a New or Existing Project-
Reference - https://msdn.microsoft.com/en-us/library/vstudio/haytww03(v=vs.100).aspx