Sunday, May 29, 2016

Book-Review: AOP in .NET (Matthew D. Groves)

The book is very good to start with Aspect Oriented Programming in .NET (as the title says it). It starts with a general overview about aspects, advice and point-cut to conquer cross-cutting concerns (as it would be described in a book for aspectJ) and adds understandable examples to show where all this stuff makes sense in combination with TDD.

Later it is shown which kind of aspects there are (those: for methods and those: for properties) and on which levels and ways these can be applied. The most important asset of the book is that it really makes it clear that there are different paradigms to make AOP. The first way described is "weaving" which actually changes the il-code in a post-compile step and "dynamic proxies" which create reflection-assemblies on the fly at runtime (the pros and cons are - in my opinion - the most important part of the book).

After reading the book i'm definitely able to write AOP code in .NET, but there are many references to IoC and DI so I would recommend to read a book about these first.

Kr, Daniel

Thursday, May 19, 2016

Castle DynamicProxy

Hi,

I am currently reading a book about AOP in .NET (book review-post will follow soon). I really fell in love with Castle DynamicProxy and it probably works even better in combination with ninject (see: https://www.nuget.org/packages/Ninject.Extensions.Interception.DynamicProxy/ --> my next topic to dive into). The good thing here is that no weaving process is needed as post-build action. This means that if you debug, you debug the actual code and not manipulated code which might not match (or prevent debugging at all).

Crosscutting-concerns will be tackled by method-interception using a proxy:

var service = new ProxyGenerator().CreateClassProxy<Class1>(new Aspect());

  • Aspect must implement IInterceptor. 
  • Class1 should have decorated its functions as virtual to create the appropriate proxy.

Often implemented aspects: logging, security, caching, threading (Invoke), lazy loading, INPC-implementation, exception handling, defensive programming and argument handling, validation, auditing, monitoring, fault tolerance.

kr, d

Backup

Today i wanted to backup my PC. There are 1000 possible ways to. My favorite solution would be: having 5 Dropbox accounts (1 for each device) with unlimited storage... 

Unfortunately this is only possible with a paid team or business license... So... No... Also any other cloud solution costs...

A possible opportunity was owncloud ... an on-premise solution with support for mobile devices. After spending hours installing a wamp-server and owncloud i found out that this can not be hosted on windows (since a couple of version ... Attention there are youtube tutorials for windows -> legacy! No windows support)

I decided to use copy jobs like robocopy or freefilesync for my PC (all directories except: windows and "program files"). This works great...

Last improvement i found is btsync (bit torrent synchronization), which copies directories over the internet. The sync-app is implemented for a lot of devices, so finally I found a way to backup my mobile phones too! yes!

Friday, May 13, 2016

Webserver cassini

I didn't know that the logic of the IIS is part of .net's fcl... Here a project using this: cassini

See: https://msdn.microsoft.com/de-de/library/bb979483.aspx

King regards,
Daniel