public void Setup() { this._idGenerator = new Base36IdGenerator( numTimestampCharacters: 11, numServerCharacters: 5, numRandomCharacters: 4, reservedValue: "", delimiter: "-", // give the positions in reverse order if you // don't want to have to account for modifying // the loop internally. To do the same in ascending // order, you would need to pass 5, 11, 17: // delimiterPositions: new[] {15, 10, 5}); delimiterPositions: new[] {5, 11, 17}); }
/// <summary> /// This all would normally be done in your IoC container /// </summary> private static void Bootstrap() { var base36 = new Base36IdGenerator( numTimestampCharacters: 12, numServerCharacters: 6, numRandomCharacters: 7, reservedValue: "", delimiter: "-", delimiterPositions: new[] { 20, 15, 10, 5 }); var connectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString; _provider = new EntityFrameworkProvider(connectionString) { IsEntityType = type => type.IsSubclassOf(typeof(Createable<>)) }; _provider.SetCurrentUser("Funcular\\Paul"); Createable<string>.IdentityFunction = () => base36.NewId(); }
public void Setup() { // This is the stuff you would normally do when configuring your IOC container. this._base36 = new Base36IdGenerator( numTimestampCharacters: 11, numServerCharacters: 4, numRandomCharacters: 5, reservedValue: "", delimiter: "-", delimiterPositions: new[] {15, 10, 5}); var connectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString; this._provider = new EntityFrameworkProvider(connectionString) { IsEntityType = type => type.IsSubclassOf(typeof (Createable<>)) }; this._provider.SetCurrentUser("Funcular\\Paul"); this._provider.GetDatabase().Log = s => Debug.WriteLine(s); Createable<string>.IdentityFunction = () => this._base36.NewId(); }
private static PerformanceTests SetupTests() { _generator = new Base36IdGenerator(11, 4, 5, null, "-", new[] {15, 10, 5}); var tests = new PerformanceTests(_generator); return tests; }