Using Objects in Razor Templates

Jan 31, 2014 at 11:57 PM
I have some custom objects that I would like to use in the Razor templates. I developed the objects for use with some modules, so everything is located in the subdirectories of the DesktopModules folder right now. Is it possible to use my objects inside the Razor Template?
Feb 1, 2014 at 7:51 AM
Can't Help you there but if its possible in normal Razor there should not be a reason why its not possible here

I have not used custom objects myself so far only thing were inline functions and helpers and imported DotNetNuke functionality

I have used cleintcapabillities for responsive images without any issues so I assume that you can also import your own custom objects like this
int rowCounter = 0;
DotNetNuke.Services.ClientCapability.IClientCapability device = DotNetNuke.Services.ClientCapability.ClientCapabilityProvider.CurrentClientCapability;
Feb 3, 2014 at 7:57 AM
Should be no problem. But it might be.

If your objects is a "normal" object without specific ties to the DNN-Environment which need initializing, just refer to the namespace and do an
var gallery = new mynamespace.Gallery();

If your object assumes it's running inside a DNN-session and has tight coupling (nasty programming, but many do it) then I don't have a quick answer.