Skip to content

Managing VS Code extension settings

To manage the settings of the VS Code extension do the following:

  1. Open file menu -> Preferences -> Settings. This will open the User Settings for editing.Scr1
  2. The screen that opens has two sections. The left section lists the settings categories and extensions. It is a read-only list. The right section lists the user modified settings, this section is editable. User settings screen also has a search bar.Scr2
  3. Type the name of the extension the settings for which you want to edit.  This will short list the default settings in the left section of the screen.Scr3
  4. From the left section of the user settings screen you can click the Edit icon for a specific setting and change its value. This is equivalent off manually adding that setting and its value in the right section of the user settings screen.Scr4
  5. When you are done close the user settings screen.
Advertisements

Where to find references to stored procedures in Entity Framework 6 in Visual Studio.

If you have stored procedures that you referenced in data model in your Entity Framework project you will see them in the following location:

<ModelName>DataModel.edmx

<ModelName>DataModel.Context.cs

<ContextName>Entities

yourStoredProcedureName

Here is the example:

2017-06-23_15-36-57

The stored procedures are listed after the tables and views, so keep scrolling to the bottom of the list if you do not see your stored procedure immediately.

Spaces in the column names and Telerik’s Kendo UI for Angular’s grid

If the data source you are trying to bind to Telerik’s Angular grid has a column that contains spaces in its name then you will see the following error generated in the browser:

ERROR SyntaxError: Unexpected identifier
    at new Function (<anonymous>)
    at getter (accessor.js:49)
    at FieldAccessorPipe.webpackJsonp.../../../../@progress/kendo-angular-grid/dist/es/field-accessor.pipe.js.FieldAccessorPipe.transform (field-accessor.pipe.js:17)
    at Object.eval [as updateRenderer] (TableBodyComponent.html:101)
    at Object.debugUpdateRenderer [as updateRenderer] (core.es5.js:13173)
    at checkAndUpdateView (core.es5.js:12322)
    at callViewAction (core.es5.js:12680)
    at execEmbeddedViewsAction (core.es5.js:12638)
    at checkAndUpdateView (core.es5.js:12318)
    at callViewAction (core.es5.js:12680)

The fix is to remove the spaces from the column names of the datasource that is bound to Telerik’s Angular grid.

How to setup a checkbox column in Telerik’s Kendo UI for Angular’s grid.

Like this:

<kendo-grid>
    [data]="itemsList"
    [height]="370"

    <kendo-grid-column field="ItemName" title="Item"></kendo-grid-column>
    <kendo-grid-column field="IsAvailable" title="Availability">
        <ng-template kendoGridCellTemplate let-dataItem let-rowIndex="rowIndex">
            <strong><input [checked]="dataItem.IsAvailable" type="checkbox" /></strong>
        </ng-template>
    </kendo-grid-column>
</kendo-grid>

of course the data source for the grid must have a property IsAvailable in order for this to work.

 

IIS Errors and HRESULT error codes

When working with websites hosted in IIS web server, you sometimes get failed requests occurring for a website. For example, suppose you are getting 500.19 error when trying to reach a resource on the web server. After simple troubleshooting you establish that everything appears to be good with the website set up.

Yet you still get 500 error. You can get more information about the error from the HRESULT error code. This code can either be obtained from the details of the Event Log entry for the failed request or by  browsing to the page and looking at the details of the error. (If you browse to the page from the client, you need to have error details enabled for the website in web.config. Alternatively, you can browse to a page from the hosting server.)

For example:

2017-06-07_15-52-02

In this case the error returned was 0x80070021

Googling around for the solution to the problem, I stumbled upon this post. It turns out that I did not have ASP.NET 4.5 installed on the host server.

 

Here are some good resources when deciphering HRESULT values:

HRESULT decoded

HRESULT possible values

 

 

Running multiple websites in IIS on the same port (different host headers)

To be able to run multiple websites on the same instance of IIS, different host headers must be set up for each website. You can also run multiple websites using different ports but this case is not the topic of discussion in this post.

For example, I have two web sites set up in IIS and both of them are setup with 1 binding each. Both sites’ bindings are setup without the Host Name and the port is set to be 80 for both:

2017-02-02_15-24-47

2017-02-02_15-25-04

Notice that only one website is started at the moment – WebSite1. If you try starting WebSite2 now, you will get the message:

2017-02-02_15-28-07

IIS is telling you that both web sites are using the same port WHILE their host headers are the same. Now, modify the binding for WebSite2:

2017-02-02_15-30-01

2017-02-02_15-30-42

Click OK and try starting the website – it starts!

 

 

Transactions in EF6

using (var dbContextTransaction = context.Database.BeginTransaction())
{
    try 
    {
       #region
       //business logic goes here
       #endregion
    
       dbContextTransaction.Commit();
    }
    catch (Exception)
    {
        dbContextTransaction.Rollback();
    }
}