コード例 #1
0
        public void Extensions()
        {
            var spec = SpecificationFactory.Create("http://here.there/patient.extended.profile.xml", "http://here.there/type-Extension.profile.xml");

            var    resource = TestProvider.LoadResource("TestData\\patient.extended.valid.xml");
            Report report   = spec.Validate(resource);

            Assert.IsTrue(report.IsValid);
        }
コード例 #2
0
        /// <summary>
        /// 创建仓储规约
        /// </summary>
        /// <returns></returns>
        public ISpecification <TEntity> CreateSpecification(object searchObj, int?pageIndex = -1, int?pageSize = -1)
        {
            ISpecification <TEntity> specification = SpecificationFactory.Create <TEntity>();

            if (pageIndex != -1 && pageSize != -1)
            {
                specification.PageIndex = pageIndex;
                specification.PageSize  = pageSize;
            }
            specification.SearchObject = searchObj;
            return(specification);
        }
コード例 #3
0
        private static async Task Main()
        {
            using (var context = new DesignTimeDbContextFactory().CreateDbContext(null))
            {
                context.ConfigureLogging(s => Console.WriteLine(s), SqlLoggerFilter);
                await BloggingContextSeed.SeedAsync(context);

                var specificationFactory = new SpecificationFactory();
                var specification        = specificationFactory.Create <Blog>()
                                           .CreatedAfter(new DateTime(2017, 1, 1));

                var blogRepository = new EfReadRepository <Blog>(context);
                var result         = blogRepository
                                     .Where(specification, b => b.Posts)
                                     .ToList();

                ConsoleTableBuilder
                .From(result.ToDataTable())
                .WithFormat(ConsoleTableBuilderFormat.Minimal)
                .ExportAndWriteLine();
            }
        }
コード例 #4
0
        static void Main(string[] args)
        {
            using (var context = new ApplicationDbContext())
            {
                var factory = new SpecificationFactory();

                var query = context.Persons.AsQueryable();

                var specification = factory.Create <Person>()
                                    .FromUkraine()
                                    .WorkInCompany();

                var persons = context.Persons.Where(specification);

                foreach (var person in persons)
                {
                    WriteLine($"Id: {person.Id}, firstName: {person.FirstName}, lastName: {person.LastName}, salary: {person.Salary}");
                }

                ReadLine();
            }
        }
コード例 #5
0
        public async Task <ActionResult <Item> > GetItems()
        {
            var list = await _repository.ListAsync(SpecificationFactory.Create <Item>());

            return(Ok(list));
        }
コード例 #6
0
 public static void Init(TestContext context)
 {
     spec = SpecificationFactory.Create("http://hl7.org/fhir/Profile/Profile");
 }
コード例 #7
0
        public void If_search_text_is_null_an_any_specification_is_returned()
        {
            var specification = factory.Create("Name", null);

            Assert.IsInstanceOfType <AnySpecification <TestTreeNode> >(specification);
        }
コード例 #8
0
 public void OtherProfile()
 {
     var spec     = SpecificationFactory.Create("http://someserver.nl/Profile/lipid.profile.xml#ldlCholesterol");
     var resource = TestProvider.LoadResource("TestData\\ldlcholesterol-correct.xml");
     var report   = spec.Validate(resource);
 }