none
Some questions about using SQL Server for lookup in a rules extension? RRS feed

  • Question

  • Hi,

    I vaguely remember seeing a whitepaper or maybe one of the walkthroughs for ILM where, within a rules extension, they were using a table in SQL server as a lookup table, e.g., for mapping attributes or something like that.

    Does anyone here recall something like that?

    The reason for I'm looking for that is that some of our "legacy" extensions are doing something like, where they map a pair of attributes (like location name and state) into postal codes.

    The way that the current code does this is to instantiate a new connection to the SQL server each time the extension is invoked, but we've been asked if it'd be possible to not do that, but to do something like create the connection at the beginning of the profile run, and then just use the same connection for the lookups/queries, and I was hoping that walkthrough (or whatever it was) might have some suggestions about how to do that in ILM.

    With ILM, is there some way to do something like that, like maybe at start of the profile run (or maybe even at ILM startup) to open a connection to an SQL server and then, within the rules extensions, re-use that already instantiated connection?

    Thanks,

    Jim

    Wednesday, July 10, 2013 8:29 PM

Answers

  • For the record, and answering my own question:  It appears that we can accomplish this by putting global variables in the class (e.g., the connection object), then:

    - In Initialize(), establish the connection

    - In other methods that need to access the SQL server for lookup, use the connection that was pre-established.

    Also, it appears that "inactivity" means basically that no methods in the DLL get called, and if there is inactivity for > 5 minutes, the Terminate() method gets called, and then the DLL gets unloaded (this includes the MVextension).

    • Marked as answer by jimcpl Saturday, July 13, 2013 9:13 AM
    Saturday, July 13, 2013 9:13 AM

All replies

  • Also, another, somewhat related question:

    I know that rules extensions and the metaverse extension are DLLs after they're built/compiled, but do the DLLs get instantiated and initialized each time they get invoked by ILM?  Or, are they instantiated and initialized only once, e.g., at ILM startup?

    Thursday, July 11, 2013 2:50 PM
  • Hi,

    Somewhat related to my question, I've found this older thread:

    http://social.technet.microsoft.com/Forums/en-US/aff84420-6ddc-41c6-86e4-a986ddeedf04/miis-2003initialize-function-in-extensionhow-it-work

    that says that, for the MVExtension (DLL), the Terminate() method gets called after 10 minutes of inactivity, and the MVExtension gets "unloaded" (the "Provisioning" Word document says 5 minute).

    That thread seems to also indicate that MA rules extensions would work the same way, but I'm somewhat unclear about what "inactivity" means in terms of (1) the MVExtension and (2) a rules extension?

    The reason for this question is that I was thinking that one way we could "persist" the SQL server connection from the rules extension is to put the code that instantiates the SQL server connection into the rules extension's Initialize() method, but that would only be viable/work if the rules extensions Terminate() method doesn't get called everytime the methods that we use in the rules extension are called?

    Thanks,

    Jim

    Thursday, July 11, 2013 4:03 PM
  • For the record, and answering my own question:  It appears that we can accomplish this by putting global variables in the class (e.g., the connection object), then:

    - In Initialize(), establish the connection

    - In other methods that need to access the SQL server for lookup, use the connection that was pre-established.

    Also, it appears that "inactivity" means basically that no methods in the DLL get called, and if there is inactivity for > 5 minutes, the Terminate() method gets called, and then the DLL gets unloaded (this includes the MVextension).

    • Marked as answer by jimcpl Saturday, July 13, 2013 9:13 AM
    Saturday, July 13, 2013 9:13 AM