Format:
Recent snippets for: Mikael Henriksson
public class Crypt { public static string OpenSslSign(string privateKeyFile, string content) { var pkey = new PrivateKey(); pkey.LoadPemFile(privateKeyFile); string pkeyXml = pkey.GetXml(); var rsa = new Rsa(); bool success = rsa.UnlockComponent("30-day trial"); if (success != true) {
179 Views
no comments
param( [Parameter(Position=0,Mandatory=0)] [string]$buildFile = 'default.ps1', [Parameter(Position=1,Mandatory=0)] [string[]]$taskList = @(), [Parameter(Position=2,Mandatory=0)] [string]$framework = '3.5', [Parameter(Position=3,Mandatory=0)] [switch]$docs = $false, [Parameter(Position=4,Mandatory=0)]
220 Views
no comments
public static class TinyUrl { private static readonly Random Random = new Random(); public static string Get() { int random = Random.Next(); return Base62ToString(uint.MaxValue); }
255 Views
no comments
<target name="buildnumber"> <if test="${property::exists('build.number')}"> <property name="project.fullversion" value="${build.number}" /> </if> <asminfo output="${solution.dir}/AssemblyInfo.cs" language="CSharp"> <imports> <import namespace="System" /> <import namespace="System.Reflection" /> <import namespace="System.Runtime.InteropServices" /> </imports>
184 Views
no comments
<UnicastBusConfig> <MessageEndpointMappings> <add Messages="Messages.Persistence" Endpoint="PersisterInputQueue" /> </MessageEndpointMappings> </UnicastBusConfig>
382 Views
no comments
For<IUnitOfWork>()
.LifecycleIs(new UniquePerRequestLifecycle())
.Use(x => new UnitOfWork(x.GetInstance<ISessionFactory>(Keys.SessionFactoryName)));
767 Views
no comments
public class WrappedFileInfo : WrappedFileSystemInfo { public WrappedFileInfo(string baseDir, string path, bool flatten) : base(baseDir, path, new FileInfo(path), flatten) { } public override void CopyToDirectory(string path) { if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } if (Flatten) {
148 Views
no comments
protected void Application_Start(object sender, EventArgs e) { try { Bus = Configure.WithWeb() .SpringBuilder() .XmlSerializer() .MsmqTransport() .IsTransactional(false) .PurgeOnStartup(false)
241 Views
no comments
function vCardTohCard(io) { var testStr = io.value.replace(/\n/gm, ""); if (testStr.match(/BEGIN:VCARD.*END:VCARD/im)) { var vCardArr = io.value.match(/^(.*)$/gm); var vCardTmp = {}; for (var prop in vCardArr) { if (vCardArr[prop] != null) { var arr = vCardArr[prop].match(/(.*?):(.*)/); if ((arr) && (arr.length = 3)) { if (vCardArr[prop].match(/URL/i)) {
210 Views
no comments
public bool OnPreInsert(PreInsertEvent @event) { var entity = @event.Entity as ParentVersion; if (entity == null) { return false; } var currentMaxVersion = @event.Session.CreateCriteria<ParentVersion>("pv") .Add(Restrictions.Eq("pv.Parent.Id", entity.Parent.Id))
187 Views
no comments
public class ParentMap : ClassMap<Parent> { public ParentMap() { Table("parent_def"); Id(x => x.Id,"parent_id"); Map(x => x.UID, "parent_uid").CustomSqlType("varchar").Length(40); Map(x => x.DeletedAt ,"dte_deleted").Nullable(); Map(x => x.ModifiedAt, "dte_modified").Nullable(); Map(x => x.CreatedAt, "dte_created").Nullable();
234 Views
no comments
.Mappings(m => {
m.FluentMappings.AddFromAssemblyOf<SomeMap>();
m.AutoMappings.AddFromAssemblyOf<SomeOtherMap>();
});
337 Views
no comments
<many-to-one cascade="all" update="false" insert="true" class="Data" foreign-key="backup_id" name="Data"> <column name="backup_id" /> </many-to-one>
191 Views
no comments
public static Configure CustomSagaPersister(this Configure config, ISessionFactory sessionFactory) { if (sessionFactory == null) { throw new InvalidOperationException("Session factory is needed for saga persistence."); } config.Configurer.RegisterSingleton<ISessionFactory>(sessionFactory); config.Configurer .ConfigureComponent<FluentSagaPersister>(ComponentCallModelEnum.Singlecall)
204 Views
no comments
public class SagaFinder : IFindSagas<MySagaData>.Using<MyMessage> { public MySagaData FindBy(MyMessage message) { } }
361 Views
no comments
Configuration config = Fluently.Configure()
.Database(MsSqlConfiguration.MsSql2008.ConnectionString(
c => c.FromConnectionStringWithKey("ConnectionString"))
.Cache(c =>
c.UseQueryCache()
.QueryCacheFactory<StandardQueryCacheFactory>()
.ProviderClass<HashtableCacheProvider>()
.UseMinimalPuts()
)
.UseReflectionOptimizer()
228 Views
no comments
new PersistenceSpecification<Component>(session, new ComponentEqualityComparer()) public class ComponentEqualityComparer : IEqualityComparer { #region IEqualityComparer Members public bool Equals(object x, object y) { if (x == null || y == null) {
193 Views
no comments
<%=Html.DropDownList("ContactHistory", ViewData["ContactHistory"], new { onchange = "doSomeJavaScript()" })%>
406 Views
no comments
private static ISessionFactory CreateSessionFactory() { return Fluently.Configure() .Database(MsSqlConfiguration.MsSql2008 .ConnectionString(c => c .FromConnectionStringWithKey("MyStore.Properties.Settings.StoreConnectionString")) ) .Mappings(m => m.FluentMappings .AddFromAssemblyOf<Program>())
223 Views
no comments
public class XmlType : IUserType { public new bool Equals(object x, object y) { if (x == null || y == null) return false; var xdoc_x = (XmlDocument)x; var xdoc_y = (XmlDocument)y; return xdoc_y.OuterXml == xdoc_x.OuterXml;
500 Views
no comments
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search
