Connection fail to SQL Server after a database restore

Scenario.

Restore SQL Server database X.
Try to conenct using the usual connection string. Conenction fail.

Yes
Yes
Delete the user in “Security” of SQL Server.
Delete the user from the “Users” of the database.
Create a new user in Server/Securit6y/Logins:
– User name: seelct a user that exists in the machine, ex.: \user
– leave everything unchaged
Create a user in the database in database/Security/Users:
– Login namne: seelct <achine\
– User name: select \
No
Todo
> Yes
< Do you use an IP address in the connection string?

in the database:
– User name: select / using hhe selector
– Login name:
– Default schema:
> No
Yes
Check the user defined in the Application Pool of the current web site
> No
Todo
> No
Todo

MVC API tests – manage unknown error raised by HttpServer

Scenario: integration tests against ASP.Net MVC API.
MVC version 5.2

Create a base class test to manage the repetitive API GET/POST calls like:

protected HttpResponseMessage Execute(HttpMethod method, string url, T data)
{
url = BASE_URL + url;

HttpRequestMessage request = new HttpRequestMessage(method, url);
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

JsonMediaTypeFormatter formatter = new JsonMediaTypeFormatter();
formatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
if (method == HttpMethod.Post && data != null)
request.Content = new ObjectContent(data, formatter);

using (var server = new HttpServer(GetConfiguration()))
using (var client = new HttpClient(server))
{
var response = client.SendAsync(request).Result;
return response;
}
}

Boom.

500. Internal server Error.

The server is set like this:
private HttpConfiguration GetConfiguration()
{
HttpConfiguration configuration = new HttpConfiguration();
//var dependencyResolver = new WindsorDependencyResolver(container);
//configuration.DependencyResolver = dependencyResolver;
WebApiConfig.Register(configuration);

// remove all HostAuthenticationFilter due to the error “no OWIN Authentication manager…”
foreach (var filter in configuration.Filters.Where(f => f.Instance is HostAuthenticationFilter).ToList())
configuration.Filters.Remove(filter.Instance);

return configuration;
}

mmhh… try to debug:
It enter in the ApiController, get the data from the REpository and it exit from the class with a nice colelction of data… what is wrong ???

Routing is ok, it is actually passing the request to the right controller.
Injection of repositories is ok, it is fetching and returning data.
Log4Net is ok, I’m not calling the “log4net.Config.XmlConfigurator.Configure();” without a proper configuration in app.config.

Adding “configuration.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;”
is absolutely useless for this problem.

What to do now?

I’ll check one of 2 or 3 previous project where I’ve already done this a where I spent 1,2 or 7 days to figure out this ALL THE TIMES fucking problem !

GIT Merge vs Rebase

Merge

When you merge a branch into another you apply both the changes done in the two branches to the final one.
In the picture example there is a merge of the changes in C4 and C5 resulting in C6.
It is a 3 way merging because it involves the common origin commit C3.

Rebase

When you rebase a branch on another you apply the specific commit of the branch on the one you are.
In the picture example the changes in C5 are reapplied to the commit C4 resulting in C5.

Differences

The result of the two operations is the same.
The goal to use Rebasing is to have a cleaner history of the changes, as they appear executed sequentially instead of in parallel.

My 2 cent

Imagine this situation.
You have done 10 changes on a branch called “Create modal dialog for new Order”.
You rebase the commits of this branch on the master branch.
For the commit “Add form validation on save button click” how someone can understand which “save” button you are talking about ?
If the reabase put all the commits under the main branch how can I see the work done for a specific feature/bug ? Detaching the commits from a specific branch seems a loose of information to me.

References: https://git-scm.com/book/en/v2/Git-Branching-Rebasing

ReSharper, what I don’t like of it

Versione 9.0 Update 1

No… these NOT:

  • use “var”
  • remove “using System;” (and System.Linq, System.Net, System.Net.Http…)
  • Intellisense: set on “Visual Studio”. With “ReSharper” selection I’ve not found immediately how to navigate overrides of method and it hide beautiful intellisense for AngularJS (and HTML%, CSS and HTML/Javascript in general from the fantastic “Web Essentials” free plugin)
  • JavaScript quote style. I have some with ‘ (single qutote) and some with ” (double quote), whart’s wrong?!
  • JavaScript: Function parameters not all in lowerCamelCase. Sorry, AngularJS style
  • Namespace does not correspond to file location. This is not Java, I want “MyProject.Test.IntegrationTest.MvcApplication.Api namespace for folder “Integration Test/MVC Appication/API”
  • Constant field (private) in “lowerCalmelCase”. No, I want the classic UPPER_CASE for constants
  • Possible multiple enumeration of IEnumerable. I’ve to live with that noise forever?
  • Constant field (not private) in “lowerCalmelCase”. No, I want the classic UPPER_CASE for constants
  • Field (not private) in “UpperCalmelCase”. No, I want the classic lowerCamelCase for this
  • Instance fields (private). Suggested name is “_xxx”. With underscore prefix? Why???
  • Use object initializer on EVERY new MyClass() in the code… ???
  • Field can be made readonly. Yes, yes, yes… but in test classes this is useless and code is more concise and readable without “readonly” everywhere.
  • JavaScript: Cannot resolve tag “…”. Of course! It is and AngularJS directive.
  • JavaScript: Replace with “strict” operator. No not everywhere!

WOW… this is very good

  • Class XXX inherited (click ti navigate)