Last active
September 2, 2015 08:15
-
-
Save vbilopav/6bc63806fe4071be5fd7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyRequestResponseFactory : IMyRequestResponseFactory | |
{ | |
public TResponse ProcessRequest<TResponse>(Request request, Func<TResponse> handler) | |
where TResponse : Response, new() | |
{ | |
try | |
{ | |
// Validacija request poruke (ovisno o tipu) | |
// Autentifikacija korisnika - podaci iz request poruke | |
// Autorizacija korisnika - podaci iz request poruke | |
// Postavljanje thread globalizacije - podaci iz request poruke | |
// konstruiranje response poruke | |
var msg = handler(); | |
// Dodatna procesiranja response, npr, spremanje u bazu... | |
// vrati response | |
return msg; | |
} | |
catch (Exception exception) | |
{ | |
// log exception | |
var logId = Log.Error(exception); | |
//Konstruiranje poruke s greškom, ErrorInfo je user friendly string koji sadrži logId | |
return new Response(ErrorInfo(logId)) as TResponse; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment