Ejemplo n.º 1
0
 protected void Application_Start()
 {
     SqlSetup.Setup();
     Config.Configure();
     AreaRegistration.RegisterAllAreas();
     GlobalConfiguration.Configure(WebApiConfig.Register);
 }
Ejemplo n.º 2
0
        public void FromConfigurationTest()
        {
            var entity = new ColumnData {
                ObjectId = 95
            };
            var resources = new Resources <DataTests>();
            var source    = resources.String("TestData.data.configuration");
            var _adapter  =
                from configuration in Configuration.FromString(source)
                from setup in SqlSetup.FromConfiguration(configuration, "all")
                from adapter in Adapter <ColumnData> .FromSetup(setup, entity)
                select adapter;

            if (_adapter.If(out var allColumnData, out var exception))
            {
                var data = allColumnData.ToArray();
                foreach (var columnData in data)
                {
                    Console.WriteLine(columnData);
                }
            }
            else
            {
                Console.WriteLine($"Exception: {exception.Message}");
            }
        }
Ejemplo n.º 3
0
        static Adapters()
        {
            setups = new StringHash <Func <DataGroups, string, ISetup> >(true)
            {
                ["sql"] = (dataGroups, adapterName) =>
                {
                    var sqlSetup = SqlSetup.FromDataGroups(dataGroups, adapterName).ForceValue();
                    sqlSetup.Handler = Handler;

                    return(sqlSetup);
                }
            };
        }
Ejemplo n.º 4
0
        public void FromConnectionStringTest()
        {
            var resources = new Resources <DataTests>();
            var source    = resources.String("TestData.data.configuration");
            var _adapter  =
                from configuration in Configuration.FromString(source)
                from setup in SqlSetup.FromConfiguration(configuration, "all2")
                from adapter in Adapter <ColumnData> .FromSetup(setup, new ColumnData { ObjectId = 5664280 })
                select adapter;

            if (_adapter.If(out var allColumnData, out var exception))
            {
                allColumnData.ConnectionString = TRUE_CONNECTION_STRING;
                foreach (var columnData in allColumnData)
                {
                    Console.WriteLine(columnData);
                }
            }
            else
            {
                Console.WriteLine($"Exception: {exception.Message}");
            }
        }