concept add in category .net

appears as: Add
Entity Framework 4 in Action

This is an excerpt from Manning's book Entity Framework 4 in Action.

Another example involves collection properties. Suppose that an order can’t have more than 10 details. You can add this value to the property in the EDM and then create a CLR custom collection that, in the Add method, compares the number of details to the limit, raising an exception or performing some other action if there are too many lines.

Because repositories must act as if they were in-memory collections, it’s logical to inherit the generic interface from ICollection<T>, which provides Add, Remove, and other typical collection methods and properties. You can then add some specific functionalities. You’ll start by defining the repository interface as shown in this listing.

Listing 18.12. Repository’s Add method