This file contains 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 interface IUUIDGenerator | |
{ | |
string Generate(ContentBase content); | |
} | |
public class GuidUIIDGenerator : IUUIDGenerator | |
{ | |
[DllImport("rpcrt4.dll", SetLastError = true)] | |
private static extern int UuidCreateSequential(out Guid guid); |
This file contains 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
using System; | |
using System.Runtime.InteropServices; | |
namespace eConduct.Extensions | |
{ | |
public static class GuidGenerator | |
{ | |
[DllImport("rpcrt4.dll", SetLastError = true)] | |
private static extern int UuidCreateSequential(out Guid guid); |
This file contains 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 class HumanNameGenerator | |
{ | |
public enum Gender | |
{ | |
Unknown = 0, | |
Male = 1, | |
Female = 2 | |
} | |
private static readonly Random Rand = new Random((int)DateTime.Now.Ticks); |
This file contains 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 class CacheHelper | |
{ | |
public static string GetCachedResult(string key, Func<string> handle, int espiration = 86400) | |
{ | |
var cache = HttpContext.Current.Cache; | |
var response = cache.Get(key); | |
if (response == null) | |
{ | |
response = handle(); |
NewerOlder