private static EntityAdapter GetAdapter(IDbCommand command, MissingPropertyMappingAction action = MissingPropertyMappingAction.Ignore) { EntityAdapter adapter = new EntityAdapter(command); adapter.MissingPropertyMappingAction = action; return(adapter); }
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); }
public PropertyMappingOptions(PropertyMappings mappings, MissingPropertyMappingAction missingPropertyMappingAction = MissingPropertyMappingAction.Error) { Mappings = mappings; MissingPropertyMappingAction = missingPropertyMappingAction; }