Creating an NRaas project Returning list from methodstore
- Chain_Reaction
- Site Admin
- Reactions:
- Posts: 7595
- Joined: December 30th, 2011, 6:00 pm
- Contact:
Returning list from methodstore
Is it possible to invoke a method using methodstore that returns a list of a type defined in the mod that is returning the list? Cause methodstore wants a type and I'm not sure what to give it... Or am I attempting the impossible again?
- Chain_Reaction
- Site Admin
- Reactions:
- Posts: 7595
- Joined: December 30th, 2011, 6:00 pm
- Contact:
MasterController.Settings is an instance of MasterControllerSpace.PersistedSettings and I wouldn't use MethodStore on that, especially considering that you'll be dealing with Persistable fields.
Anyway, all the fields in Settings are stored in Persistence so they can be exported and imported. There's probably a way to import the SkillStamps from MasterController by using Persistence but that would require the other assembly to have the same class, otherwise those types won't be recognized, unless you treat them as "object", but they would become pretty useless
Anyway, all the fields in Settings are stored in Persistence so they can be exported and imported. There's probably a way to import the SkillStamps from MasterController by using Persistence but that would require the other assembly to have the same class, otherwise those types won't be recognized, unless you treat them as "object", but they would become pretty useless
- Chain_Reaction
- Site Admin
- Reactions:
- Posts: 7595
- Joined: December 30th, 2011, 6:00 pm
- Contact:
You'd still need something to represent it in the assembly. If not the SkillStamp class, an interface located in NRaas.Common with a couple of properties or method to retrieve the values you want. This way you can find the types by having SkillStamp implement the interface and with MethodStore invoke the method to get the list
P.S. You'd still require an external static method that you can invoke, such as :
<!-- ws:start:WikiTextCodeRule:0:
<pre class="text">public static List<ISkillStamp> GetSkillStamps()<br/>{<br/> // iterate over the list of skillstamps, cast to ISkillStamp, add to new list<br/>}</pre>
-->
<style type="text/css"><!--
/**
* GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
* (http://qbnz.com/highlighter/ and http://geshi.org/)
*/
.text {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }
-->
</style><pre class="text">public static List<ISkillStamp> GetSkillStamps()
{
// iterate over the list of skillstamps, cast to ISkillStamp, add to new list
}</pre>
<!-- ws:start:WikiTextCodeRule:0:
<pre class="text">public static List<ISkillStamp> GetSkillStamps()<br/>{<br/> // iterate over the list of skillstamps, cast to ISkillStamp, add to new list<br/>}</pre>
-->
<style type="text/css"><!--
/**
* GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
* (http://qbnz.com/highlighter/ and http://geshi.org/)
*/
.text {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }
-->
</style><pre class="text">public static List<ISkillStamp> GetSkillStamps()
{
// iterate over the list of skillstamps, cast to ISkillStamp, add to new list
}</pre>