The correct way to implement StructureMap in .NET Core WebApi when having multiple projects

StructureMap is an IoC/DI container for .Net which has been a long time around. I’ve been using it for these past few years, and after all this time, I found out the correct way to implement it.

This is how I used it before and I’m sure the majority of you are currently using the same methods. In the Registry, I would register each interface and it’s inherited class by calling a “config.for” for each service as follows…

Continue Reading

Advertisements

How to exclude Json properties from WebApi response using a custom ContractResolver

I am currently working on a Backend API that acts as a middleman to a Front API and a DocumentDB database (the structure is shown in the above image).

I had the following class which is used to send data to both the Front API and to the DocumentDB. Some of the fields needed to be hidden when returning a response back to the Front API, since they weren’t useful for the user and for security concerns. First I tried using [JsonIgnore] and [IgnoreDataMember] (as seen below), which successfully excluded the required fields from the response, but using them was also excluding the same fields when sending the data to DocumentDB, so it was a no-go.

Continue Reading

My Blog Is Moving

Dear Surfers & Readers,

Hope that all of you are fine and thanks for reading this blog. Have not been writing much posts as of lately but I was busy making some new plans for my new place on the internet.

I had this place on wordpress for these last 5 years, 3 months and 4 weeks. It was nice writing posts on ciappara.wordpress.com but now the time has come to move and be independent. Don’t worry, I’m not going away. I’m just moving this blog to a personal web address. From now on you can find me and my new posts on www.ciappara.com. I had to do this a long long time ago, but now it’s time.

In this blog I write any problems that I face while developing applications and websites. The response from other people having these problems was amazing in that users started helping each other in the comments. I will update my new blog on a more regular pace and also have plans to start making some new fun stuff as well… but i will tell you more on this later on.

Hope to see you all on www.ciappara.com! Btw, what do you think of my logo… any suggestions?

Ordered my Nokia Lumia 800

And just like that, I just ordered my Nokia Lumia 800 on 12th December at exactly 9:00pm!! Today Amazon.de made a Cyber Monday sale where it slashed prices for more than 300 items, and the Nokia Lumia’s price slashing began at 9:00:00pm and ended at 9:00:20pm.. it only took 20 seconds for all the stock to finish!!! And I was one of the lucky to get one at a reduced price!!! Hussaahhh.

Now waiting for the delivery to take place!! 🙂 Hopefully it doesn’t take long!! 🙂 Btw it’s the Black one.. the blue one is still not available.. but the black will do just as good 🙂

Samsung Galaxy Nexus Leaked :)

Hey what do we have here? Is this the supposedly Samsung Nexus Prime with Google’s Android Ice-Cream Sandwich? It was leaked on Samsung’s US Website whilst searching for Galaxy Nexus.. you can see for yourself here.

Apparently the name changed to Galaxy Nexus. More details soon, as it will be unveiled in an hour, though I will not be seein it live.. as here in Malta it’s already 2am, and anyway I’m more into Windows Phone 😛 Let me know any info, as it gets revealed..

Happy Ice-creaming!

Steve Jobs passed Away!! :(

Just read some very sad news! Steve Jobs passed away. Apple confirmed the news on its Web site. He was a great visionary that led a mobile-computing revolution with wildly popular devices such as the iPhone! Jobs leaves behind his wife, four children, two sisters, and 49,000 Apple employees :/ Very unfortunate!!

Apple’s “Let’s Talk” keynote was Booring!!

Don’t get me wrong, they added some new features to iOS 5, but all together, it wasn’t much of a show. I expected a bigger screen (not the same old 3.5 inch one), some NFC goodness, and at least a different chassis, tinner like say the Galaxy SII. In a few months and even weeks, the specs on this phone will be outpaced by other smartphones. Read more specs after the break… Continue reading