Serilog used with Prism 8 and Injecting Microsoft.Extensions.Logging.ILogger - prism

Using .Net 5 WPF, Serilog and PrismLibrary 8 with Unity
Can someone please guide me in the right direction so I can inject Microsoft.Extensions.Logging.ILogger into ViewModels etc.
I have found many snippets, but all fails on some point or another.
I prefer using Microsoft.Extensions.Logging.ILogger for flexibility in coice of logging provider.

Related

Lagom with Spring

Lagom by default uses Google Guice as implementation od DI pattern.
I would like to use Spring Framework instead.
Is it possible? IF so, how should it be done?
I have successfully integrated Akka with Spring (using hints from documentation and Internet), however I cannot find anything in documentation about integrating with Spring.
Possible? Yes. Will you be constantly swimming upstream, with reach upgrade break in new and unexpected ways requiring you to debug undocumented internal APIs? Most probably.
Lagom is built on Play, Play's DI support is ostensibly pluggable, when I wrote it I hacked together a proof of concept to ensure that Spring could be plugged into it. But it was only ever a proof of concept, neither I or the Play team ever had any desire or intention of maintaining it, so I published my work to GitHub:
https://github.com/jroper/play-spring
So that anyone for whom Spring support was important could continue where I left off. That was 3 years ago. In spite of a community of over a hundred thousand developers, no one ever took the work up. There's not a lot of work to do on the module itself, where most of the work would be is in Play and Lagom to fix areas where they have grown incompatible with Spring.
But really, why do you want to use Spring? The whole Lagom and Play ecosystems are built on Guice, saying you want to use Spring with Lagom is like saying you want to use a narrow gauge train in a country that only has standard guage rails, you're going to have to build yourself an entire new rail system to do so. What do you hope to achieve?

How to Replace Web Service Binding - Tuscany SCA with Spring from scratch

I have had some experience of developing web services (standalone) which are called via angularjs single page apps. But, I now have a Java EE task which involves the following:
1. Removing a Tuscany SCA web service binding from some business components e.g. Customer, Accounts. The components are exposed as web services
2. Replacing the Tuscany Binding with a Spring Injection web service binding.
NOTE: The decision to replace Tuscany SCA with Spring is already made.
But, as a developer with experience of developing web service without any knowledge of the binding frameworks. I need some understanding of what these frameworks are, how I can wire this framework to my web service from scratch.
I don't just want to copy and paste and do try and error on a commercial project.
I am afraid, there was no KT, hence I am learning this the hard way!
Please, can someone help me in understanding this underlying framework or binding.
What are this binding or binding frameworks?
Why do we need them?
How is Tuscany SCA different from Spring?
Any help good, practical, code sample, online references etc will be appreciated.
Thanks.
You are not clear with concept of SOA, SCA and Tuscany.
First understand which type of webservice is written in your project whether RESTFul or SOAP. And then understand how SCA + Tuscany service is written for for RESTFul/SOAP service and then try to remove Tuscany from it.
Reference docs:
http://tuscany.apache.org/documentation-2x/sca-java-bindingrest.html
http://www.springsource.org/spring-integration

Asp.net mvc with or without ORM

Soon i will be starting to work on a small to medium web project. I will be the only developer to work on this project. So i am looking for pointers towards some design decisions/tools/technology. I would like to use asp.net MVC for this web project (the reason being this project has got good chance to grow a lot, therefore thinking more maintainable).
We use oracle as our backend and configured enterprise application data access block to use with odp.net and seems to have worked well. But all of our previous projects were typically asp.net web forms/windows forms.
So with mvc, is it better to use ORM like nhibernate than DAAB?
I have gone through this article, but still confused.. Thanks

why a ioc framework for MVC 3?

After plenty of reading, I still don't understand Unity for MVC 3.
Specific points
Why use it? I can create a controller that in its constructor, it takes a new EF context for testing.
How? I keep seeing bits are parts, but is there an end to end walk through on implementing Unity on MVC 3 (Live)? There seem to be plenty on Beta and RC, but the code always seems to have a problem on live frameworks.
Currently this is not impacting my unit testing, since my controllers have overloaded constructors, as does my EF context.
If you have a small project, you may not benefit from IoC.
Lifetime management if a plus for me. I don't have to dispose a repository (or service layer) in every controller. It thins out my code and creates the object for me. In addition, I know I have a clean separation in case I ever need to change things. It almost forces me to. I use for example IRepository that is backed by entity framework. For testing I use a fake IRepository implementation. So sure, I could manually create it in my application but this leads to some bad practices in larger projects and I lose the benefits of having the interface.
I have a basic demo for a super short talk I did recently on this for (15 minutes) mvc and unity for dependency injection using the unity.mvc3 nuget package:
http://completedevelopment.blogspot.com/2011/12/using-dependency-injection-with-mvc.html
Btw. Dependency Injection in .Net - best book on the subject without a doubt.
It's very useful for wiring up all your dependencies, handling life cycle of your objects, error handling, transaction handling, testing purposes and ...
All of above point are advantages of using an IoC framework, but I strongly recommend using Ninject. it has a very friendly DSL for binding modules, has out of box library and extensions for ASP.NET MVC and is an open source lightweight DI framework.
It has also many extensions.

Create Custom Membership Provider (Entity Framework vs Linq)

I'm starting work on a Custom Membership provider and I was wondering which option would be the best to develop this application in Linq or Entity Framework?
Also I have a need to link two table from different database via a common ID and I was wondering does anyone know of any good tutorials about creating a MVC 3 Web Application that uses either Linq or Entity Framework to do this.
From my research Entity Framework seems to be the best method suited to my situation but I would appreciate some advice / confirmation that this correct and a little direction to a tutorial is possible?
By Linq, you mean Linq to SQL vs. Entity framework? If so, then I would recommend using Entity Framework. Microsoft's development on Linq to SQL has virtually stopped so EF has a better future.
NerdDinner is one of the more popular tutorial applications that uses ASP MVC 2 and entity framework. ASP MVC 2 is similar enough to get started with the basic concepts. Here is a good walk through tutorial:
http://nerddinnerbook.s3.amazonaws.com/Intro.htm
The code itself is freely available:
http://nerddinner.codeplex.com/

Resources