示例#1
0
        public IDataModel LoadModel(String source, String command, System.Object prms = null)
        {
            var modelReader = new DataModelReader(_localizer);

            source          = ResolveSource(source, prms);
            using var token = _profiler.Start(command);
            ReadData(source, command,
                     (prm) =>
            {
                modelReader.SetParameters(prm, prms);
            },
                     (no, rdr) =>
            {
                modelReader.ProcessOneRecord(rdr);
            },
                     (no, rdr) =>
            {
                modelReader.ProcessOneMetadata(rdr);
            });
            modelReader.PostProcess();
            return(modelReader.DataModel);
        }
示例#2
0
        public async Task <IDataModel> LoadModelAsync(String source, String command, System.Object prms = null)
        {
            var modelReader = new DataModelReader(_localizer);

            using (var p = _profiler.Start(command))
            {
                await ReadDataAsync(source, command,
                                    (prm) =>
                {
                    modelReader.SetParameters(prm, prms);
                },
                                    (no, rdr) =>
                {
                    modelReader.ProcessOneRecord(rdr);
                },
                                    (no, rdr) =>
                {
                    modelReader.ProcessOneMetadata(rdr);
                });
            }
            modelReader.PostProcess();
            return(modelReader.DataModel);
        }