Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class FooRepo
- {
- public string ConnectionStringName { get; }
- public string SchemaName { get; }
- public string TableName { get; }
- public Dictionary<string, int> ColumnLengths { get; }
- public Dictionary<Type, SqlDbType> TypeMappings { get; }
- // some queries...
- public IEnumerable<string> GetStrings(object param1) { ... }
- }
- class Foo
- {
- public Foo() {}
- public string Bar { get; private set; }
- public string Qux { get; }
- public class Builder
- {
- private Foo _foo = new Foo();
- private Builder() {}
- public static Builder Create()
- {
- return new Builder();
- }
- public Builder Bar(string bar)
- {
- _foo.Bar = bar;
- return this;
- }
- public Foo ToFoo()
- {
- return new Foo()
- {
- Bar = _foo.Bar
- };
- }
- }
- }
- var foo = Foo.Builder.Create().Bar("baz").ToFoo();
- var bar = foo.Bar;
- var foo = new FooRepo(string connectionStringName, other parameters...);
- var bar = remute.With(foo, x => x.ConnectionStringName, "updated connection");
Add Comment
Please, Sign In to add comment