Skip to content

Instantly share code, notes, and snippets.

View lprichar's full-sized avatar

Lee Richardson lprichar

View GitHub Profile
@lprichar
lprichar / LeesStoreDbContextModelCreatingExtensions.cs
Created December 6, 2020 16:31
Auto Entity Model Adding During DB Context Creation via Reflection for ABP.IO
var allDbSets = typeof(LeesStoreDbContext).GetProperties()
.Where(p => p.PropertyType.Name == "DbSet`1")
.Select(p => new
{
Type = p.PropertyType.GetGenericArguments()[0],
p.Name
})
.Where(p => p.Name != nameof(LeesStoreDbContext.Users));
foreach (var property in allDbSets)
@lprichar
lprichar / LeesStoreDbContextModelCreatingExtensions.cs
Created October 25, 2020 15:11
Reflection code to configure all EF entities by convention
public static class LeesStoreDbContextModelCreatingExtensions
{
public static void ConfigureLeesStore(this ModelBuilder builder)
{
var allDbSets = typeof(LeesStoreDbContext).GetProperties()
.Where(p => p.PropertyType.Name == "DbSet`1")
.Select(p => new
{
Type = p.PropertyType.GetGenericArguments()[0],
p.Name
@lprichar
lprichar / MainActivity.cs
Created January 31, 2017 04:18
Xamarin Android ExpandableListView Example
using System.Collections.Generic;
using System.Linq;
using Android.App;
using Android.Content;
using Android.Widget;
using Android.OS;
using Android.Views;
using Object = Java.Lang.Object;
namespace Droid.Sample
@lprichar
lprichar / pascals_triangle.fs
Created August 27, 2016 05:40
Generates Pascal's Triangle in F#
open System
let totalRows = 9
type Node =
{ Row: int;
Position: int;
Value: int
}