-4

My EF insert method is defined as follows:

public void Add(params T[] items)

How can it be used with ObjectDataSource to insert objects?

CodeCaster
  • 147,647
  • 23
  • 218
  • 272
Yevgeni Grinberg
  • 359
  • 5
  • 19

1 Answers1

1

According to the documentation, the insert method for an ObjectDataSource is designed to call a method that has parameters for each value of the item being inserted, not the item itself (let alone an array of items).

I would either add an overload to your repository that accepts the value for a single item (and perhaps calls Add), or add a mapper somewhere that maps the values to a new item and calls your Add method.

D Stanley
  • 149,601
  • 11
  • 178
  • 240