Reply to thread

gibman,

i made some progress with TvWishlist, but I am now running into another roadblock:

I have defined my own class Setting which includes its own repository.

The function Remove should delete a setting by creating a new repository in DeleteSettings.

Tracing the log there is an entry "f", but no more entry "a" and the setting is not getting deleted.

Do i need to define a new ServiceAgent for that first? Can I do that from within a plugin, as I saw that all service agents are registered within the main code from the class.

Needless to say that i am a complete newby on this part.




public void Remove()

  {

  Log.Debug("f");

  DeleteSettings(this.Tag);

  Log.Debug("e");

  }


  


  private static void DeleteSettings(string tagName)

  {

  using (ISettingsRepository settingRepository = new SettingsRepository(true))

  {

  Log.Debug("a");

  settingRepository.Delete<Mediaportal.TV.Server.TVDatabase.Entities.Setting>(s => s.Tag == tagName);

  Log.Debug("b");

  settingRepository.UnitOfWork.SaveChanges();

  Log.Debug("c");

 

  }

  }


  public static IList<Setting> QuerySettings()

  {

  using (ISettingsRepository settingRepository = new SettingsRepository(true))

  {

  IQueryable<Setting> query = settingRepository.GetQuery<Setting>(s => s.Tag == "*"); //should return all settings from the data base in a list

  settingRepository.UnitOfWork.SaveChanges();

  return query.ToList();

  }

  }


Top Bottom