Example #1
0
        public void BootstrappingYourLibrariesWithFluentApis()
        {
            // To make my library, I can instantiate everything independantly
            var firstD1 = new Dependency();
            var firstD2 = new Dependency2 {
                SomeConfigurationProperty = "aa", SomeOptionalConfigurationProperty = "bb"
            };
            var firstLibraryInstantiation = new MyLibraryEntryPoint(firstD1, firstD2);

            // Or, you can offer a discoverable entry point and build a fluent interface
            var configured =
                MyFluentlyConfiguredLib.SetUp().With(
                    x =>
            {
                x.SomeConfigurationProperty = "my setting";
            })
                .AndSomeOptionalThing(x => { })
                .AndSomeOptionalThing(x => { })
                .AndSomeRequiredFinalThing(x => { });

            var secondInstance = configured.Create();
        }
        public void BootstrappingYourLibrariesWithFluentApis()
        {
            // To make my library, I can instantiate everything independantly
            var firstD1 = new Dependency();
            var firstD2 = new Dependency2 { SomeConfigurationProperty = "aa", SomeOptionalConfigurationProperty = "bb" };
            var firstLibraryInstantiation = new MyLibraryEntryPoint(firstD1, firstD2);

            // Or, you can offer a discoverable entry point and build a fluent interface
            var configured =
                MyFluentlyConfiguredLib.SetUp().With(
                    x =>
                    {
                        x.SomeConfigurationProperty = "my setting";
                    })
                    .AndSomeOptionalThing(x => { })
                    .AndSomeOptionalThing(x => { })
                    .AndSomeRequiredFinalThing(x => { });

            var secondInstance = configured.Create();
        }
 public MyLibraryEntryPoint(Dependency d1, Dependency2 d2)
 {
     _d1 = d1;
     _d2 = d2;
 }
Example #4
0
 public MyLibraryEntryPoint(Dependency d1, Dependency2 d2)
 {
     _d1 = d1;
     _d2 = d2;
 }