Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Everything behaves exactly as it should :)</p> <p>In your C++ project, you are allowed to access all the methods declared on your <code>IEntity</code> interface, which there are none.</p> <p>Your implementation, i.e. <code>AQSEntity</code> class, should implement all the <code>IEntity</code> members. The methods which are now declared in that class are member of the class, they are not related to <code>IEntity</code> in any way.</p> <p>This means you need to declare all the required methods inside <code>IEntity</code> interface and then implement them in <code>AQSEntity</code>. Notice that you are also exposing the fields of the class, not the methods. You will have to define methods (or properties, which will get converted to methods on C++ side) and then implement them. Something like:</p> <pre><code>public interface IEntity { public string RecoveryDBName { get; } } </code></pre> <p>You also have to specify <code>[MarshalAs]</code> attributes in the interface, although <code>UnmanagedType.BStr</code> is default for strings, so you can omit them.</p> <p>EDIT:</p> <p>based on comments, it seems that <code>IEntity</code> is just a marker interface, not intended to be exposed as an API (attributes might be better option here, as <code>IEntity</code> won't be used on client side anyway).</p> <p>In this case there are two options:</p> <p>1) better approach, although it requires more work: derive <code>IAQSEntity</code> interface from <code>IEntity</code>, declare methods on it, and implement that on <code>AQSEntity</code> class</p> <p>2) less work, but more brittle: Mark <code>AQSEntity</code> as <code>ClassInterfaceType.AutoDual</code> instead of <code>ClassInterfaceType.None</code> - this will expose the members to COM clients, but will be much harder to version and it will also expose the base type members.</p> <p>Here's what I would choose:</p> <pre><code>[ClassInterface(ClassInterfaceType.None)] ... [Entity] // instead of IEntity marker interface public class AQSEntity : IAQSEntity { public string RecoveryDbName { get; } } [Guid("...")] [InterfaceType(ComInterfaceType.InterfaceIsDual)] public interface IAQSEntity // no base interface IEntity! { string RecoveryDbName { get; } } </code></pre> <p>The only drawback of using <code>Entity</code> attribute instead of <code>IEntity</code> marker interface is if you want to use the interface as constraint for generics</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload