DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Hello I'm yunus emre.I'm a 24 year old.I have been living in istanbul,Turkey.I'm incredibly passionate about what I do and enjoy working with other open minded, enthusiastic people. I also like to share my experiences with others and blog regularly here. Buzz Words : .NET 2.0 and upwards C# ASP.NET (Web Forms, MVC, Web API) HTML/CSS MSSQL RavenDB Various Data Access libraries - from Disconnected and connected for SqlClient, NHibernate and Entity Framework I currently have been working as a software engineer in intertech.I am developing software to functional requirements and fixing bugs on banking platform using microsoft technologies in here. I'm interested in backend software development and enterprise software organizations.I'm keen on mostly about software architectures , design patterns , object oriented programming and enterprise software development.I have wrote articles in my own blog and communities about these topics.Also i like drawing software diagrams To become a good software engineer requires a good theoretical background as well as practical experiences.Therefore I will try to improve myself daily.New technologies and experiences raises new ideas and so we can change the world with these ideas.I believe that. I want to develop software on international projects in a international atmosphere Yunus Emre has posted 10 posts at DZone. You can read more from them at their website. View Full User Profile

Layer Level Logging

01.08.2014
| 1628 views |
  • submit to reddit
/// <summary>
/// possible layers
/// </summary>
public abstract class LayerDefinitions
{
     public static string ServiceHostLayer { get { return "Sample.Service.Host"; } }
     public static string ServiceRepositorylayer { get { return "Sample.Service.Repository"; } }
     public static string CommonRepositorylayer { get { return "Sample.Common.Repository"; } }
     public static string DataAccessLayer { get { return "Sample.DataAccess"; } }
     public static string WebSecurityLayer { get { return "Sample.WebSecurity"; } }
     public static string CoreLayer { get { return "Sample.Core"; } }
     public static string UtilLayer { get { return "Sample.Util"; } }
}
 
/// <summary>
///  loging library : Log4net
/// </summary>
public class LoggerService
{
    public static log4net.ILog Log
    {
        get
        {
            return log4net.LogManager
                            .GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
        }
    }
        
    public static void Setup(HttpContext context)
    {
        string path = context.Server.MapPath("log4net.config");
        if (File.Exists(path))
        {
            log4net.Config.XmlConfigurator.ConfigureAndWatch(new FileInfo(path));
        }
    }
}

Our projects design as modular, layered   in order to reduce development process and spent time.So our solution design become more simple, can be controled.You can use in below code stucture for especially enterprise solutions in projects with a lot of  logical layer.

Let’s take a look our enterprise codes.


gist link ; https://gist.github.com/yemrekeskin/5613861#file-layerlevellogging-cs