home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 2
Plugin Development
How To Do Native SQL Queries in TVE35 plugins
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="huha" data-source="post: 1033277" data-attributes="member: 63847"><p>gibman,</p><p>i made some progress with TvWishlist, but I am now running into another roadblock:</p><p>I have defined my own class Setting which includes its own repository.</p><p>The function Remove should delete a setting by creating a new repository in DeleteSettings.</p><p>Tracing the log there is an entry "f", but no more entry "a" and the setting is not getting deleted.</p><p>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.</p><p>Needless to say that i am a complete newby on this part.</p><p></p><p></p><p></p><p>public void Remove()</p><p> {</p><p> Log.Debug("f");</p><p> DeleteSettings(this.Tag);</p><p> Log.Debug("e");</p><p> }</p><p></p><p> </p><p></p><p> private static void DeleteSettings(string tagName)</p><p> {</p><p> using (ISettingsRepository settingRepository = new SettingsRepository(true))</p><p> {</p><p> Log.Debug("a");</p><p> settingRepository.Delete<Mediaportal.TV.Server.TVDatabase.Entities.Setting>(s => s.Tag == tagName);</p><p> Log.Debug("b");</p><p> settingRepository.UnitOfWork.SaveChanges();</p><p> Log.Debug("c");</p><p> </p><p> }</p><p> }</p><p></p><p> public static IList<Setting> QuerySettings()</p><p> {</p><p> using (ISettingsRepository settingRepository = new SettingsRepository(true))</p><p> {</p><p> IQueryable<Setting> query = settingRepository.GetQuery<Setting>(s => s.Tag == "*"); //should return all settings from the data base in a list</p><p> settingRepository.UnitOfWork.SaveChanges();</p><p> return query.ToList();</p><p> }</p><p> }</p></blockquote><p></p>
[QUOTE="huha, post: 1033277, member: 63847"] 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(); } } [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 2
Plugin Development
How To Do Native SQL Queries in TVE35 plugins
Contact us
RSS
Top
Bottom