cancel
Showing results for 
Search instead for 
Did you mean: 

EnterpriseService interface?

first_last
Participant
0 Kudos

I'm attempting to create a server-side instance of the RAS. Here's the code:

using BusinessObjects.Enterprise.Framework;
using BusinessObjects.Enterprise.Infostore;
using CrystalDecisions.Enterprise;
using CrystalDecisions.ReportAppServer.ClientDoc;
using CrystalDecisions.ReportAppServer.DataDefModel;
using BusinessObjects.Enterprise.Exception;

// token provided.
IEnterpriseSession enterpriseSession = CrystalEnterprise.GetSessionMgr().LogonWithToken(token);

// Interop type 'EnterpriseService' cannot be embedded.  Use applicable interface instead
EnterpriseService enterpriseService = (EnterpriseService)enterpriseSession.GetService("RASReportFactory");
ReportAppFactory reportAppFactory = (ReportAppFactory)enterpriseService.Interface;

ReportClientDocument reportClientDocument = null;

try 
{
  // id provided
  reportClientDocument = reportAppFactory.OpenDocument(id, 0);

  // do something
}
catch (SDKException e)
{
  Debug.Print(e.Message);
  throw;
} 
catch (Exception e)
{
  Debug.Print(e.Message);
  throw;  
}
finally
{
  if (reportClientDocument != null)
  {
    reportClientDocument.Close();
    reportClientDocument = null;
  }
}

Questions:

  • I can't seem to locate the IEnterpriseService interface. Is there one? Which assembly contains it?
  • Am I following a good pattern for using RAS?
  • Why doesn't the ReportDocumentClient implement IDisposable?

Edit. the project targets ".Net Framework 4.6.1".

Accepted Solutions (1)

Accepted Solutions (1)

first_last
Participant
0 Kudos

I needed to change the CrystalDecisions.Enterprise.Framework assembly's Embed Interop Types setting to False to eliminate the error message.

I applied this to all CrystalDecsions.* and BusinessObjects.* assemblies.

Answers (0)