Skip to content

Instantly share code, notes, and snippets.

View FransBouma's full-sized avatar

Frans Bouma FransBouma

View GitHub Profile
@FransBouma
FransBouma / OrderCustomerMtoMQueries.cs
Created September 10, 2015 10:32
Auto-generated Linq queries from derived model definition on entity model.
//------------------------------------------------------------------------------
// <auto-generated>This code was generated by LLBLGen Pro v5.0.</auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Dtos.DtoClasses;
using Northwind.Adapter.Linq;
using SD.LLBLGen.Pro.ORMSupportClasses;
@FransBouma
FransBouma / OrderDetailDoc.cs
Last active August 26, 2015 14:09
Generated class from Derived Element (element derived from entity graph / entity sub model, denormalized). LLBLGen Pro v5. Attributes re added using rules (so defined once)
//------------------------------------------------------------------------------
// <auto-generated>This code was generated by LLBLGen Pro v5.0.</auto-generated>
//------------------------------------------------------------------------------
using System;
using System.ComponentModel;
using System.Runtime.Serialization;
using System.Xml.Serialization;
using System.Collections.Specialized;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
@FransBouma
FransBouma / C#
Created July 21, 2015 08:49
.NET 4.6 breaking change?
internal static MethodInfo QueryableAllPredicate = GetQueryableMethodInfo(typeof(Queryable), "All",
(TSource) => new[]
{
typeof(IQueryable<>).MakeGenericType(TSource),
typeof(System.Linq.Expressions.Expression<>).MakeGenericType(typeof(Func<,>).MakeGenericType(TSource, typeof(bool)))
});
private static MethodInfo GetQueryableMethodInfo(Type declaringType, string methodName, Func<Type, Type[]> parameterTypeFactory)
{
return GetQueryableMethodInfo(declaringType, methodName, parameterTypeFactory.Method);
<?xml version="1.0" encoding="utf-8"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" >
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>True/PM</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
@FransBouma
FransBouma / enbeffectprepass.fx
Created March 23, 2015 12:06
enbeffectprepass.fx with desaturation
//////////////////////////////////////////////////////////////////////////
// //
// ENBSeries effect file //
// visit http://enbdev.com for updates //
// Copyright (c) 2007- Boris Vorontsov //
// //
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
// //
// enbeffectprepass.fx depth of field by kingeric1992, //
// based on GDC 2004 presentation: //
@FransBouma
FransBouma / gist:25ca8404add6fa145cce
Last active December 19, 2016 09:16
My email conversation with a certain MS employee regarding WPF

I'm not going to disagree with your comments on WinForms/WPF or current limitations for WinRT. Let me focus on WinForms/WPF for a minute...

First, I'm curious if your client application needs to support Windows 7? If so, the choice is clear for a Windows platform, WPF. If is the technology that is alive and staffed by the same team building future investments into the Windows client platform.

I was a bit surprised to read this. I do recall this: http://www.zdnet.com/blog/microsoft/microsoft-splits-up-its-xaml-team-whats-the-fallout/9807 which suggests there are multiple teams doing something with xaml, but I learn from your email that this isn't the case?

@FransBouma
FransBouma / gist:8403b388aa30d3207be2
Last active August 29, 2015 14:08
How in-memory .net calls are in-lined in the final query in LLBLGen Pro's linq provider
var q = ctx.Customers.Select(c=>new Customer() { CompName = SomeMethod(c.CompanyName)});
-> visit the select lambda, and convert it so it becomes:
(values, indices) => new Customer() { CompName = SomeMethod(values[indices[0]])};
then compile the lambda. At projection time, execute the lambda with the object[] obtained from the datareader as 'values'
and a set of indices, one for each db value placed in the project. This way you can have any in-memory call in the projection
<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 14">
@FransBouma
FransBouma / gist:5e7031fe557df4b5b688
Created June 12, 2014 08:53
Do Contains calls in chunks. Original by Marc Gravell. Fixed for LLBLGen Pro
public static class QueryableChunked
{
public static IEnumerable<T> InRange<T, TValue>(this IQueryable<T> source,
System.Linq.Expressions.Expression<Func<T, TValue>> selector, int blockSize,
IEnumerable<TValue> values)
{
MethodInfo method = null;
foreach(MethodInfo tmp in typeof(Enumerable).GetMethods(BindingFlags.Public | BindingFlags.Static))
{
if(tmp.Name == "Contains" && tmp.IsGenericMethodDefinition && tmp.GetParameters().Length == 2)
Non-change tracking individual fetches (100 elements, 10 runs), no caching
------------------------------------------------------------------------------
Handcoded materializer using DbDataReader : 0,79ms per individual fetch
PetaPoco Fast v4.0.3 : 0,90ms per individual fetch
LLBLGen Pro v4.2.0.0 (v4.2.14.0424), Poco typed view with QuerySpec : 0,95ms per individual fetch
LLBLGen Pro v4.2.0.0 (v4.2.14.0424), typed view : 1,21ms per individual fetch
Linq to Sql v4.0.0.0 (v4.0.30319.33440) : 2,53ms per individual fetch
LLBLGen Pro v4.2.0.0 (v4.2.14.0424), Poco typed view with Linq : 6,50ms per individual fetch