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 class GuidComb | |
{ | |
public static Guid NewGuid() | |
{ | |
byte[] b = Guid.NewGuid().ToByteArray(); | |
DateTime dateTime = new DateTime(1900, 1, 1); | |
DateTime now = DateTime.Now; | |
TimeSpan timeSpan = new TimeSpan(now.Ticks - dateTime.Ticks); | |
TimeSpan timeOfDay = now.TimeOfDay; | |
byte[] bytes1 = BitConverter.GetBytes(timeSpan.Days); |
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 interface IActivity | |
{ | |
void Run(); | |
bool Matches(int i); | |
} | |
public class PluginCoordinator | |
{ | |
private readonly IPluginActivator _activator; | |
private readonly PluginRunner _pluginRunner; |
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 interface IActivity | |
{ | |
void Run(); | |
bool Matches(int i); | |
} | |
public class PluginRunner | |
{ | |
private readonly IContainer _container; | |
private readonly ILogger _logger; |
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 SqlBuilder | |
{ | |
Dictionary<string, Clauses> data = new Dictionary<string, Clauses>(); | |
int seq; | |
class Clause | |
{ | |
public string Sql { get; set; } | |
public List<object> Parameters { 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 ValidationBehavior<T> : BasicBehavior where T : class | |
{ | |
IFubuRequest request; | |
IChainResolver chain; | |
IPartialFactory _factory; | |
public ValidationBehavior(IFubuRequest request, IChainResolver chain, IPartialFactory factory) : base(PartialBehavior.Executes) | |
{ | |
this.request = request; | |
this.chain = chain; |
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 ValidationBehavior<T> : BasicBehavior where T : class | |
{ | |
IFubuRequest request; | |
IChainResolver chain; | |
ContinuationHandler continuation; | |
public ValidationBehavior(IFubuRequest request, IChainResolver chain, ContinuationHandler continuation) : base(PartialBehavior.Executes) | |
{ | |
this.request = request; | |
this.chain = chain; |
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
_databaseQuery.Execute("insert into temp1 (t) values (@0)" | |
, new SqlParameter() { SqlDbType = SqlDbType.VarBinary, Value = new byte[] {12, 1, 34, 234}}); |
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
//This is how I use PetaPoco with structure map but I'm also using the IDatabase interface from my branch at http://github.com/schotime/petapoco | |
public class PetaPocoRegistry : Registry | |
{ | |
public PetaPocoRegistry() | |
{ | |
Scan(x => | |
{ | |
x.TheCallingAssembly(); | |
x.WithDefaultConventions(); |
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 Security | |
{ | |
public int SecurityId { get; set; } | |
public string Name { get; set; } | |
} | |
public class User | |
{ | |
public int UserId { get; set; } | |
public string FirstName { 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
var sql = "!" + application.Server.HtmlEncode(item.Sql).Replace("] ", "] ") + "!"; //Glimpse Sanitizer workaround |