Искали ant проверили множество примеров на этом форуме, но не смогли получить полностью работоспособный метод.
Я использую linq для массового ввода списка классов сущностей (RemoteReadings).
Из-за уникальных ограничений мне нужно отфильтровать любые уже вставленные элементы.
Uniqiuness состоит из 2 столбцов meterid и datetime в таблице RemoteReadings.
// approx 5000 records (I need to do this in batches of 2000 due to a 
// constraint in L2S,but can do this after get this working)
List<RemoteReading> lst = createListFromCSV(); 
// Option 1:
// This does not work as am comparing memory list to db list. I need to use contains() method.
// Actually am trying to accomplish this infollowing examples.
List<RemoteReading> myLst = (from ri in db.RemoteReadings                                                       
                            from l in lst 
                            where l.meterid = ri.meterid 
                            && l.date = r.date
                            select ri).ToList();
////
// Option2:
// Get the list from DB that are in memory lst 
List<RemoteReading> myLst = (from ri in db.RemoteReadings                                                       
                            where 
                            // where in this list by comparing meaterid and datemeaured
                            (from l in lst
                            select 
/// help here !
///
                            select ri).ToList<RemoteInterconnectorReading>();
// Option3:
// Get the list from lst that are not in database
// I am bit confused here !
// Tried also to remove from list any duplicates:
List<RemoteReading> result = List<RemoteReading>)myLst.Except(lst).ToList<RemoteReading>();
// Ultimately
db.RemoteReading.InsertAllOnSubmit(result);
db.submitChanges();
Любая помощь, пожалуйста?
