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 FilterConfig | |
{ | |
public static void RegisterGlobalFilters(GlobalFilterCollection filters) | |
{ | |
filters.Add(new LogFilterAttribute()); | |
} | |
} |
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 EnumDescriptionAttribute : Attribute | |
{ | |
public Type ResourceType { get; set; } | |
public EnumDescriptionAttribute(Type resourceType) | |
{ | |
ResourceType = resourceType; | |
} | |
} |
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
//użycie bezpośrednie napisu | |
var applicationName = ConfigurationManager.AppSettings["ApplicationName"]; | |
//skorzystanie z stałej | |
var applicationName = ConfigurationManager.AppSettings[SettingsNames.ApplicationName]; |
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 static string ToDisplayString(this Enum value) | |
{ | |
if (value == null) | |
{ | |
throw new ArgumentNullException("value"); | |
} | |
string description = value.ToString(); | |
EnumDescriptionAttribute[] attributes = (EnumDescriptionAttribute[])value.GetType().GetCustomAttributes(typeof(EnumDescriptionAttribute), false); |
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 Benchmarks | |
{ | |
[Benchmark] | |
public void UsingResources() | |
{ | |
var test = Resources.One; | |
} | |
} |
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 BaseModel | |
{ | |
public BaseModel() | |
{ | |
IsActive = true; | |
} | |
public int Id { get; set; } | |
public bool IsActive { get; set; } |
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 Products1Controller : Controller | |
{ | |
private DataContext db = new DataContext(); | |
// GET: /Products1/ | |
public ActionResult Index() | |
{ | |
return View(db.Products.ToList()); | |
} |
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 DateService : IDateService | |
{ | |
public DateTime ConvertToUtc(DateTime dateTime) | |
{ | |
TimeZoneInfo timeZone = TimeZoneInfo.FindSystemTimeZoneById(GetTimezone()); | |
var date = DateTime.SpecifyKind(dateTime, DateTimeKind.Unspecified); | |
return TimeZoneInfo.ConvertTimeToUtc(date, timeZone); | |
} | |
public DateTime ConvertToLocal(DateTime dateTime) |
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 CacheService : ICacheService | |
{ | |
private ICacheManager<object> _cache; | |
private const string _defaultCacheName = "defaultCache"; | |
public CacheService() | |
{ | |
var builder = ConfigurationBuilder.LoadConfiguration(_defaultCacheName).Builder; | |
builder.WithMicrosoftLogging(s => s.AddNLog()); |
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
class Program | |
{ | |
private static NLog.Logger _logger = NLog.LogManager.GetCurrentClassLogger(); | |
static void Main(string[] args) | |
{ | |
_logger.Info("Start"); | |
try | |
{ | |
var content = Download("http://plawgo.pl"); |