When I try to implement WebApi with owin, i got an error
IAppBuilder’ does not contain a definition for ‘UseWebApi’ and no extension method ‘UseWebApi’ accepting a first argument of type ‘IAppBuilder’ could be found (are you missing a using directive or an assembly reference?)
Solution is you need to install Microsoft ASP.NET Web API2 OWIN Self Host which will resolve the issue.
You can use the NuGet command Install-Package Microsoft.AspNet.WebApi.OwinSelfHost.
Some days before I got an error while try to update migration like :
UploadedData_GrpCategory_Target_UploadedData_GrpCategory_Source: : The types of all properties in the Dependent Role of a referential constraint must be the same as the corresponding property types in the Principal Role. The type of property ‘Category’ on entity ‘UploadedData’ does not match the type of property ‘Id’ on entity ‘GrpCategory’ in the referential constraint ‘UploadedData_GrpCategory’.
I didn’t understand what it is in first look. Then I understood , I created Primary key and foreign key in different datatypes in Entities.
Last day I got a requirement, it need a pivot table. I generated this table in SQL and read it to a datatable. No issues. Then I want convert this datatable to a list. I can’t create a entity because columns are dynamic. I stuck here some time and got a solution .
public static class HelperExtensions
public static List<dynamic> ToDynamic(this DataTable dt)
var dynamicDt = new List<dynamic>();
foreach (DataRow row in dt.Rows)
dynamic dyn = new ExpandoObject();
foreach (DataColumn column in dt.Columns)
var dic = (IDictionary<string, object>)dyn;
dic[column.ColumnName] = row[column];