示例#1
0
        private static EntityAdapter GetAdapter(IDbCommand command, MissingPropertyMappingAction action = MissingPropertyMappingAction.Ignore)
        {
            EntityAdapter adapter = new EntityAdapter(command);

            adapter.MissingPropertyMappingAction = action;
            return(adapter);
        }
示例#2
0
        public void CreateCollection(MissingPropertyMappingAction action)
        {
            const string  expected = "SELECT * FROM Production.ProductVariant WHERE ProductVariantId > @_p0";
            EntityAdapter adapter;

            using (SqlCommand command = GetCommand("SELECT * FROM Production.ProductVariant WHERE ProductVariantId > {0}", 100))
            {
                Assert.AreEqual(expected, command.CommandText);
                Assert.AreEqual(1, command.Parameters.Count);
                Assert.AreEqual(100, command.Parameters[0].Value);

                adapter = GetAdapter(command, action);
            }

            Collection <Product> products = adapter.CreateCollection <Product>();

            Assert.IsTrue(products.Count > 1);
        }
示例#3
0
 public PropertyMappingOptions(PropertyMappings mappings, MissingPropertyMappingAction missingPropertyMappingAction = MissingPropertyMappingAction.Error)
 {
     Mappings = mappings;
     MissingPropertyMappingAction = missingPropertyMappingAction;
 }