Page 1 of 1

using custom .net class in php

PostPosted: August 24th, 2015, 6:45 pm
by cadean
Hi,

I have searched your support forum and wiki, but unfortunately my search terms are not specific enough to find anything useful. I have a need to execute custom .net c# classes from our php code. When I enter the php "use" keyword your tool displays a list of the Microsoft .net classes, but does not display my own custom classes. Do you have documentation, or a wiki article, that describes the steps I must follow to render my classes available in the php "use" statement? I have added my projects as References to the project as created from your Phalanger "Empty Wen Application" template, but this did not help.

Thanks!

Re: using custom .net class in php

PostPosted: August 25th, 2015, 4:14 pm
by cadean
Hi,

Attached is a picture of the current failure. Note that I am not a PHP developer, but my team will be supporting a PHP team with our custom .NET class libraries.

There is a generated metadata file that appears to be accurate:
<?php // Generated code

namespace Intel\IT\EAAS\LCap\Services\Aurora\Common;

class CPassport
{
#region Functions

/**
*
* @param mixed $objA
* @param mixed $objB
*
* @return bool
*/
public function Equals($objA, $objB) { /* function body is hidden */ }

/**
*
* @return void
*/
protected function Finalize() { /* function body is hidden */ }

/**
*
* @return \System\Collections\Generic\IEnumerable`1[[Intel\IT\EAAS\LCap\Services\Aurora\Contract\PassportMatter, Contract, Version=1\0\0\0, Culture=neutral, PublicKeyToken=null]]
*/
public function GetAllMatters() { /* function body is hidden */ }

Thanks,

Re: using custom .net class in php

PostPosted: August 26th, 2015, 1:23 pm
by Jakub Misek
Hi,

Sorry for the delay.

Please ensure you are referencing your .NET dll from your Phalanger project.

You can either add reference within Visual Studio, or add following into your web.config or app.config
Code: Select all
<phpnet><classLibrary><add url='bin\mydll.dll' />


There is an example showing the first option at viewtopic.php?f=13&t=541 . I've updated the sample for latest Phalanger.

There might be an issue, if the class is not resolved in compile-time - in this case, I would suggest the second option and add reference into web.config/app.config so the reference will be resolved in runtime.