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
SQLiteDatabase Plugin for MP2
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="MJGraf" data-source="post: 1031750" data-attributes="member: 17886"><p>Thanks mrj,</p><p></p><p>I thought about something even simpler. I use the inbuilt setting system of MP2 which means I have a separate SQLiteSettings class. This class contains the default values as constants. When you startup MP2 Server for the first time, these values are written to disk as an XML file. As of then MP2 uses the XML file to read the settings, i.e. you can change the values in the XML file. When you want to go back to the default values, you just have to delete the XML file. On the next startup, a new XML files with the standard values is automatically generated again. This is at least how other parts of MP2 handle this.</p><p></p><p>That reminds me of something that we could improve in the settings system. We have an attribute to be applied to the respective setting properties. With the attribute we can specify whether this is a per user or global setting. We can also specify a default value through this attribute. But as default value we can only use constants. It would be helpful if we could also use a parameterless delegate - which is not possible at the moment. Use case: The default value for the cache size of the SQLiteDatabase is not a constant, but it depends on the amount of RAM available to the OS. So I wrote a little method which determines the amount of RAM and based on this returns the recommended default cache size. Currently I have to do a workaround to get this working (using the constructor of the SQLiteSettings class to call this method and store the result in a private variable. For the settings property I use a default value of -1 in the respective attribute and in the Get-method of the property I check whether it is -1 and if so I return the calculated value from the private variable - else the value actually stored in the property). It would be much simpler if we could just use a delegate to the calculating method as default value in the attribute. No need for any workaround. But that's just a reminder so that I don't forget about it... <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite2" alt=";)" title="Wink ;)" loading="lazy" data-shortname=";)" /></p></blockquote><p></p>
[QUOTE="MJGraf, post: 1031750, member: 17886"] Thanks mrj, I thought about something even simpler. I use the inbuilt setting system of MP2 which means I have a separate SQLiteSettings class. This class contains the default values as constants. When you startup MP2 Server for the first time, these values are written to disk as an XML file. As of then MP2 uses the XML file to read the settings, i.e. you can change the values in the XML file. When you want to go back to the default values, you just have to delete the XML file. On the next startup, a new XML files with the standard values is automatically generated again. This is at least how other parts of MP2 handle this. That reminds me of something that we could improve in the settings system. We have an attribute to be applied to the respective setting properties. With the attribute we can specify whether this is a per user or global setting. We can also specify a default value through this attribute. But as default value we can only use constants. It would be helpful if we could also use a parameterless delegate - which is not possible at the moment. Use case: The default value for the cache size of the SQLiteDatabase is not a constant, but it depends on the amount of RAM available to the OS. So I wrote a little method which determines the amount of RAM and based on this returns the recommended default cache size. Currently I have to do a workaround to get this working (using the constructor of the SQLiteSettings class to call this method and store the result in a private variable. For the settings property I use a default value of -1 in the respective attribute and in the Get-method of the property I check whether it is -1 and if so I return the calculated value from the private variable - else the value actually stored in the property). It would be much simpler if we could just use a delegate to the calculating method as default value in the attribute. No need for any workaround. But that's just a reminder so that I don't forget about it... ;) [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 2
Plugin Development
SQLiteDatabase Plugin for MP2
Contact us
RSS
Top
Bottom