Persist Data by Programming Against Interface

Your repository should accept BankAccount – not IBankAccount because Linq-to-sql doesn’t know what is IBankAccount and compiler doesn’t allow you to store it without casting it first to BankAccount (that can obviously fail at runtime if IBankAccount instance is not a BankAccount).

Once you have BankAccount you simply call:


Leave a Comment