no dogma blog
no dogma blog
Blog Posts
Podcast
Web API Lambda Course
Polly Course
Photos
Contact
Support this Site
About
RSS
Light
Dark
Automatic
Posts
Web API 2 and ninject, how to make them work together
Full source code to download. I’ve been using ninject for a few years, but every time I use it with Web Api I hit some problem and they usually stem from not including the right nuget packages, not changing the DependencyResolver or (once) forgetting how to make a binding!
Apr 22, 2016
#
AspNet
,
Dependency Injection
,
ninject
,
WebApi
Entity Framework, checking the connection string of your context
Sometimes when using Entity Framework I want to verify that I’m connected to the database I think I’m connected to. Here’s how to check in Entity Framework 5, Entity Framework 6 and Entity Framework Core 1 (EF 7)
Apr 11, 2016
#
Connection Strings
,
Entity Framework
Customizing a specific string inside a class using AutoFixture
Full source code. I’ve been using AutoFixture for a while with my unit tests. It creates objects with prefilled data, saving me the hassle of manually constructing them. Basic usage If you want a string from AutoFixture do something like -
Apr 7, 2016
#
AutoFixture
,
SpecimenBuilder
,
TDD
,
Testing
Why you should use IDictionary, IList, etc
Summary When returning objects from a method try to use IList, IDictionary, etc instead of List and Dictionary. This is especially important when the method is inside a class library which you distribute.
Feb 17, 2016
#
Casting
,
Dictionary
,
Interfaces
Filtering a Dictionary by value with a List as the value
Filtering out entries in a dictionary is not too difficult when the key and value are simple. For example if you had - IDictionary oneToFourDictionary = new Dictionary {{ "one", 1 }, { "two", 2 }, { "three", 3 }, { "four", 4 } };
Feb 11, 2016
#
Dictionary
,
Filter
Parameterized SQL WHERE IN clause C#
If you are using some legacy SQL in C# you’ll occasionally need to write a WHERE IN. You don’t want to end up writing something like the below, either directly or through some sort of loop.
Jan 28, 2016
#
Extension Method
,
Parameters
,
SQL
,
WHERE IN
,
C#
ASP.NET 5 Web Api Controller with multiple get methods
I have two other posts on multiple GET methods, both for Web Api 2. the first shows how to use routes like http://…/api/values/geta. the second shows http://…/api/values/22 or http://…/api/values/AAC1FB7B-978B-4C39-A90D-271A031BFE5D.
Jan 15, 2016
#
ASP.NET 5
,
AspNet
,
Routing
,
WebApi
How to fix 'No database providers are configured' when scaffolding a controller in ASP.NET 5
If got this error when trying to scaffold a new controller (MVC and Web Api) for an ASP.NET 5 web app using Visual Studio 2015. There was an error running the selected code generator: 'No database providers are configured.
Jan 15, 2016
#
ASP.NET 5
,
Controllers
,
Scaffolding
,
Visual Studio 2015
The type 'xxxx' is defined in an assembly that is not referenced. System.Runtime.
If you recognize the error from the title of this post, you can jump to the solution. The problem I have a ASP.NET 5 solution with two projects, a web application project and a class library project.
Jan 15, 2016
#
ASP.NET 5
,
Configuration
Adding class libraries to an ASP.NET 5 web application
When adding a class library to an ASP.NET 5 application you might get an error like “The following projects are not supported as references: - The project ClassLibrary1 has a target framework that is incompatible or has a version higher than the current project and cannot be referenced”
Jan 14, 2016
#
ASP.NET 5
,
AspNet
,
Visual Studio 2015
«
»
Cite
×