# CodeFirst and Client-Side interfaces - Generates only one interface file

**URL:** https://talk.remobjects.com/t/codefirst-and-client-side-interfaces-generates-only-one-interface-file/17395
**Category:** Remoting SDK
**Tags:** delphi
**Created:** [September 11, 2018, 7:45pm UTC](https://talk.remobjects.com/t/codefirst-and-client-side-interfaces-generates-only-one-interface-file/17395 "2018-09-11T19:45:39Z")
**Posts on this page:** 20
**Page:** 3

<div class="post-metadata">

### Author: ![EvgenyK](https://talk.remobjects.com/user_avatar/talk.remobjects.com/evgenyk/32/16_2.png) [@EvgenyK](https://talk.remobjects.com/u/EvgenyK)
#### Post date: [February 15, 2019, 3:03pm UTC](https://talk.remobjects.com/t/codefirst-and-client-side-interfaces-generates-only-one-interface-file/17395/46 "2019-02-15T15:03:25Z")

</div>

yes, you need to use [http://localhost:8099/rodl?servicegroup=LOGIN](http://localhost:8099/rodl?servicegroup=LOGIN) as parameter for rodl2code

---

<div class="post-metadata">

### Author: ![Smokoveck](https://talk.remobjects.com/user_avatar/talk.remobjects.com/smokoveck/32/6672_2.png) [@Smokoveck](https://talk.remobjects.com/u/Smokoveck)
#### Post date: [February 15, 2019, 4:54pm UTC](https://talk.remobjects.com/t/codefirst-and-client-side-interfaces-generates-only-one-interface-file/17395/47 "2019-02-15T16:54:32Z")

</div>

when I try to use the following error occurs:

Processing RODL file [http://localhost:8099/rodl?servicegroup=LOGIN](http://localhost:8099/rodl?servicegroup=LOGIN)  
Generating intf  
There was a problem loading the RODL.

System.Exception: unknown type: DataParameter  
em RemObjects.SDK.CodeGen4.DelphiRodlCodeGen.Intf\_generateReadStatement(RodlLibrary library, String aElementType, CGExpression aSerializer, CGCallParameter aName, CGCallParameter aValue, CGTypeReference aDataType, CGCallParameter aIndex)  
em RemObjects.SDK.CodeGen4.DelphiRodlCodeGen.Intf\_GenerateArray(CGCodeUnit file, RodlLibrary library, RodlArray entity)  
em RemObjects.SDK.CodeGen4.DelphiRodlCodeGen.GenerateInterfaceCodeUnit(RodlLibrary library, String aTargetNamespace, String aUnitName)  
em RemObjects.SDK.CodeGen4.RodlCodeGen.GenerateInterfaceFile(RodlLibrary library, String aTargetNamespace, String aUnitName)  
em RemObjects.SDK.CodeGen4.\_\_Global.Main(String[] \_\_args)

---

<div class="post-metadata">

### Author: ![EvgenyK](https://talk.remobjects.com/user_avatar/talk.remobjects.com/evgenyk/32/16_2.png) [@EvgenyK](https://talk.remobjects.com/u/EvgenyK)
#### Post date: [February 18, 2019, 8:16am UTC](https://talk.remobjects.com/t/codefirst-and-client-side-interfaces-generates-only-one-interface-file/17395/48 "2019-02-18T08:16:31Z")

</div>

I’ve reproduced this issue, investigating

---

<div class="post-metadata">

### Author: ![RemObjectsSoftware](https://talk.remobjects.com/user_avatar/talk.remobjects.com/remobjectssoftware/32/15947_2.png) [@RemObjectsSoftware](https://talk.remobjects.com/u/RemObjectsSoftware)
#### Post date: [February 18, 2019, 11:14am UTC](https://talk.remobjects.com/t/codefirst-and-client-side-interfaces-generates-only-one-interface-file/17395/49 "2019-02-18T11:14:09Z")

</div>

Thanks, logged as bugs://81989

---

<div class="post-metadata">

### Author: ![RemObjectsSoftware](https://talk.remobjects.com/user_avatar/talk.remobjects.com/remobjectssoftware/32/15947_2.png) [@RemObjectsSoftware](https://talk.remobjects.com/u/RemObjectsSoftware)
#### Post date: [February 18, 2019, 11:18am UTC](https://talk.remobjects.com/t/codefirst-and-client-side-interfaces-generates-only-one-interface-file/17395/50 "2019-02-18T11:18:37Z")

</div>

bugs://81989 got closed with status fixed.

---

<div class="post-metadata">

### Author: ![EvgenyK](https://talk.remobjects.com/user_avatar/talk.remobjects.com/evgenyk/32/16_2.png) [@EvgenyK](https://talk.remobjects.com/u/EvgenyK)
#### Post date: [February 18, 2019, 11:20am UTC](https://talk.remobjects.com/t/codefirst-and-client-side-interfaces-generates-only-one-interface-file/17395/51 "2019-02-18T11:20:32Z")

</div>

can you update `uRODLToXML.pas` as

> **changes**
>
> ```auto
> procedure TRODLToXML.FillServiceGroupExceptionList(aLibrary: TRODLLibrary);
> 
> procedure _CheckArray(anArray: TRODLArray); forward;
> procedure _CheckStruct(aStruct: TRODLBaseStruct); forward;
> 
> procedure _CheckType(aDatatype: String);
> var
> ar: TRODLArray;
> st: TRODLStruct;
> begin
> ar := aLibrary.FindArray(aDatatype);
> st := aLibrary.FindStruct(aDatatype);
> if (st <> nil) or (ar <> nil) or (aLibrary.FindEnum(aDatatype) <> nil) then begin
> RegisterDataType(aDatatype);
> if ar <> nil then _CheckArray(ar);
> if st <> nil then _CheckStruct(st);
> end;
> end;
> 
> procedure _CheckArray(anArray: TRODLArray);
> begin
> _CheckType(anArray.ElementType);
> end;
> 
> procedure _CheckStruct(aStruct: TRODLBaseStruct);
> var
> i: Integer;
> begin
> if aStruct.Ancestor <> '' then _CheckType(aStruct.Ancestor);
> for i := 0 to aStruct.Count -1 do
> _CheckType(aStruct.Items[i].DataType);
> end;
> 
> procedure _CheckService(aService: TRODLBaseService);
> var
> si: TRODLServiceInterface;
> o: TRODLOperation;
> j,k,l: Integer;
> begin
> for j:=0 to aService.Count - 1 do begin
> si := aService.Items[j];
> for k := 0 to si.Count - 1 do begin
> o := si.Items[k];
> if o.Result <> nil then _CheckType(o.Result.DataType);
> for l := 0 to o.Count-1 do
> _CheckType(o.Items[l].DataType);
> end;
> if aService.Ancestor <> '' then begin
> aService := aLibrary.FindService(aService.Ancestor);
> if aService <> nil then _CheckService(aService);
> end;
> end;
> end;
> 
> var
> i: Integer;
> ls: TRODLBaseService;
> ar: TRODLArray;
> st: TRODLStruct;
> begin
> for i := 0 to (aLibrary.ServiceCount - 1) do begin
> ls := aLibrary.Services[i];
> if isFlatten(ls) then begin
> if fExcludePrivateServices and ls.isPrivate then Continue;
> if not ContainsServiceGroup(ls) then Continue;
> _CheckService(ls);
> end;
> end;
> 
> for i := 0 to aLibrary.EventSinkCount -1 do begin
> ls := aLibrary.EventSinks[i];
> if isFlatten(ls) then begin
> if not ContainsServiceGroup(ls) then Continue;
> _CheckService(ls);
> end;
> end;
> 
> for i := 0 to aLibrary.ExceptionCount - 1 do begin
> RegisterDataType(aLibrary.Exceptions[i].Name);
> _CheckStruct(aLibrary.Exceptions[i]);
> end;
> 
> for i := 0 to (aLibrary.ArrayCount -1 ) do begin
> ar := aLibrary.Arrays[i];
> if not ContainsServiceGroup(ar) then Continue;
> RegisterDataType(ar.Name);
> _CheckArray(ar);
> end;
> 
> for i := 0 to (aLibrary.StructCount -1 ) do begin
> st := aLibrary.Structs[i];
> if not ContainsServiceGroup(st) then Continue;
> RegisterDataType(st.Name);
> _CheckStruct(st);
> end;
> 
> end;
> 
> ```

rebuild your server and generate again \_Intf with `rodl2code`, pls?

---

<div class="post-metadata">

### Author: ![Smokoveck](https://talk.remobjects.com/user_avatar/talk.remobjects.com/smokoveck/32/6672_2.png) [@Smokoveck](https://talk.remobjects.com/u/Smokoveck)
#### Post date: [February 18, 2019, 12:51pm UTC](https://talk.remobjects.com/t/codefirst-and-client-side-interfaces-generates-only-one-interface-file/17395/52 "2019-02-18T12:51:40Z")

</div>

Hi

Very good!! it works!!

Just a little problem, when you generate the \_intf the output file name is from another service name.

see attachment file.

Thks.

[INTF\_TASK\_WS\_Intf.pas](https://talk.remobjects.com/uploads/default/original/2X/6/670e6331eb95fcf3c1bea06cea501eba6b92c155.pas) (1.1 MB)

---

<div class="post-metadata">

### Author: ![EvgenyK](https://talk.remobjects.com/user_avatar/talk.remobjects.com/evgenyk/32/16_2.png) [@EvgenyK](https://talk.remobjects.com/u/EvgenyK)
#### Post date: [February 18, 2019, 12:55pm UTC](https://talk.remobjects.com/t/codefirst-and-client-side-interfaces-generates-only-one-interface-file/17395/53 "2019-02-18T12:55:16Z")

</div>

how it should be named?

as for me - everything is correct:  
`INTF_TASK_WS_Intf.pas` vs `unit INTF_TASK_WS_Intf;`

---

<div class="post-metadata">

### Author: ![Smokoveck](https://talk.remobjects.com/user_avatar/talk.remobjects.com/smokoveck/32/6672_2.png) [@Smokoveck](https://talk.remobjects.com/u/Smokoveck)
#### Post date: [February 18, 2019, 1:03pm UTC](https://talk.remobjects.com/t/codefirst-and-client-side-interfaces-generates-only-one-interface-file/17395/54 "2019-02-18T13:03:33Z")

</div>

The service I am generating is LOGIN (servicegroup=LOGIN) , so the unit name should be LOGIN\_Intf

LOGIN\_Intf.pas and unit LOGIN\_Intf;

I do not understand why he writes the name as INTF\_TASK\_WS\_Intf.

---

<div class="post-metadata">

### Author: ![EvgenyK](https://talk.remobjects.com/user_avatar/talk.remobjects.com/evgenyk/32/16_2.png) [@EvgenyK](https://talk.remobjects.com/u/EvgenyK)
#### Post date: [February 18, 2019, 1:24pm UTC](https://talk.remobjects.com/t/codefirst-and-client-side-interfaces-generates-only-one-interface-file/17395/55 "2019-02-18T13:24:43Z")

</div>

it generates filename based on your name in RODL, i.e. `%rodl_library_name%_Intf`.  
in your case, you have `INTF_TASK_WS` as Library Name in RODL

---

<div class="post-metadata">

### Author: ![Smokoveck](https://talk.remobjects.com/user_avatar/talk.remobjects.com/smokoveck/32/6672_2.png) [@Smokoveck](https://talk.remobjects.com/u/Smokoveck)
#### Post date: [February 18, 2019, 2:32pm UTC](https://talk.remobjects.com/t/codefirst-and-client-side-interfaces-generates-only-one-interface-file/17395/56 "2019-02-18T14:32:22Z")

</div>

But when it’s based on FirstCode there’s no more rodl, is not it? This already happens when it generates a single interface file for all services, when generated, it puts the name of the \_intf file as the last service of my project group (.dll).

---

<div class="post-metadata">

### Author: ![EvgenyK](https://talk.remobjects.com/user_avatar/talk.remobjects.com/evgenyk/32/16_2.png) [@EvgenyK](https://talk.remobjects.com/u/EvgenyK)
#### Post date: [February 18, 2019, 3:32pm UTC](https://talk.remobjects.com/t/codefirst-and-client-side-interfaces-generates-only-one-interface-file/17395/57 "2019-02-18T15:32:37Z")

</div>

RODL file is generated on-fly in CodeFirst mode.

you can specify library name/ID as

```auto
  uRORTTIServerSupport.RODLLibraryName := LibraryName;
  uRORTTIServerSupport.RODLLibraryID := LibraryUID;

```

if you didn’t specify it manually, it will be assigned in runtime as

```auto
  RODLLibraryName := ChangeFileExt(ExtractFileName(ParamStr(0)),'');

```

---

<div class="post-metadata">

### Author: ![Smokoveck](https://talk.remobjects.com/user_avatar/talk.remobjects.com/smokoveck/32/6672_2.png) [@Smokoveck](https://talk.remobjects.com/u/Smokoveck)
#### Post date: [February 18, 2019, 7:55pm UTC](https://talk.remobjects.com/t/codefirst-and-client-side-interfaces-generates-only-one-interface-file/17395/59 "2019-02-18T19:55:02Z")

</div>

All files \* \_RODLtypes.pas has the assignment:

uRORTTIServerSupport.RODLLibraryName: = LibraryName;  
uRORTTIServerSupport.RODLLibraryID: = LibraryUID;

I think it’s recovering the name of the last service loaded in .dll group project.

---

<div class="post-metadata">

### Author: ![EvgenyK](https://talk.remobjects.com/user_avatar/talk.remobjects.com/evgenyk/32/16_2.png) [@EvgenyK](https://talk.remobjects.com/u/EvgenyK)
#### Post date: [February 19, 2019, 8:18am UTC](https://talk.remobjects.com/t/codefirst-and-client-side-interfaces-generates-only-one-interface-file/17395/60 "2019-02-19T08:18:08Z")

</div>

what value of `LibraryName` do you have in .exe and in .dll?  
do you use runtime packages?  
if yes, make sure that `uRORTTIServerSupport.RODLLibraryName` is set only in .exe

---

<div class="post-metadata">

### Author: ![Smokoveck](https://talk.remobjects.com/user_avatar/talk.remobjects.com/smokoveck/32/6672_2.png) [@Smokoveck](https://talk.remobjects.com/u/Smokoveck)
#### Post date: [February 19, 2019, 12:03pm UTC](https://talk.remobjects.com/t/codefirst-and-client-side-interfaces-generates-only-one-interface-file/17395/61 "2019-02-19T12:03:45Z")

</div>

yes, I’m using runtime packages.

Sorry, but I’m not understanding. I have several services in my dll, each service has its file \* \_RODLTypes.pas that set RODLLibraryName.

When I run to generate the interface (\_intf) I think it should generate for the service I specified in the parameter, example of the LOGIN service I’m trying, so, the unit and name should be LOGIN\_Intf, could not get from NameSpace?

---

<div class="post-metadata">

### Author: ![EvgenyK](https://talk.remobjects.com/user_avatar/talk.remobjects.com/evgenyk/32/16_2.png) [@EvgenyK](https://talk.remobjects.com/u/EvgenyK)
#### Post date: [February 19, 2019, 12:08pm UTC](https://talk.remobjects.com/t/codefirst-and-client-side-interfaces-generates-only-one-interface-file/17395/62 "2019-02-19T12:08:50Z")

</div>

When run-time package are used , the same variable is modified from all packages. as a result, it got value from your last dll.

I can suggest for your scenario (.dll are compiled with runtime packages), change `RODLLibraryName` only in main code and not in dll

---

<div class="post-metadata">

### Author: ![Smokoveck](https://talk.remobjects.com/user_avatar/talk.remobjects.com/smokoveck/32/6672_2.png) [@Smokoveck](https://talk.remobjects.com/u/Smokoveck)
#### Post date: [February 19, 2019, 2:38pm UTC](https://talk.remobjects.com/t/codefirst-and-client-side-interfaces-generates-only-one-interface-file/17395/63 "2019-02-19T14:38:29Z")

</div>

Right, I’ve changed. But think of the following scenario: I have a server application that loads 10 services, ie the rodl2code will generate 10 separate interfaces, I’ll pass the command line 10 times changing only the parameter (url with the servicegroup" ) how will it change the interface names as the servicegroup informed? if the set RODLLibraryName of gets .exe it will only have one service name,

---

<div class="post-metadata">

### Author: ![EvgenyK](https://talk.remobjects.com/user_avatar/talk.remobjects.com/evgenyk/32/16_2.png) [@EvgenyK](https://talk.remobjects.com/u/EvgenyK)
#### Post date: [February 19, 2019, 3:38pm UTC](https://talk.remobjects.com/t/codefirst-and-client-side-interfaces-generates-only-one-interface-file/17395/64 "2019-02-19T15:38:52Z")

</div>

why you can put each generated \_intf into personal folders, like

- dll1\NewLibrary\_Intf.pas
- …
- dll10\NewLibrary\_Intf.pas  
?

---

<div class="post-metadata">

### Author: ![Smokoveck](https://talk.remobjects.com/user_avatar/talk.remobjects.com/smokoveck/32/6672_2.png) [@Smokoveck](https://talk.remobjects.com/u/Smokoveck)
#### Post date: [February 19, 2019, 5:06pm UTC](https://talk.remobjects.com/t/codefirst-and-client-side-interfaces-generates-only-one-interface-file/17395/65 "2019-02-19T17:06:52Z")

</div>

for each dll I have several services and the services use each other’s services, I can not have interfaces (\_intf) with the same name, besides, on the client side, uses the services of several dlls (ie transparent to the client side ), for example, uses LOGIN\_INTF, DEPART\_INTF, LOCATION\_INTF these services can be in any dll.

---

<div class="post-metadata">

### Author: ![EvgenyK](https://talk.remobjects.com/user_avatar/talk.remobjects.com/evgenyk/32/16_2.png) [@EvgenyK](https://talk.remobjects.com/u/EvgenyK)
#### Post date: [February 19, 2019, 5:25pm UTC](https://talk.remobjects.com/t/codefirst-and-client-side-interfaces-generates-only-one-interface-file/17395/66 "2019-02-19T17:25:04Z")

</div>

I understood your idea.  
what I can suggest:

- get RODLLibrary from [http://localhost:8099/rodl?servicegroup=XXXXXX](http://localhost:8099/rodl?servicegroup=XXXXXX) with  
`(MyChannel as IROMetadataReader).RetrieveRODL(...)`
- replace `Library.Name` in generated RODL with new name
- pass given RODLLibrary into `TROCodegen4` (uROCodegen4Helper.pas):

```auto
  gen:= TROCodegen4.Create;
  try
    rec := gen.Generate(aLibrary, cg4l_Delphi, cg4m_Intf);

```

- receive generated \_Intf file from `rec`

[Previous page](https://talk.remobjects.com/t/codefirst-and-client-side-interfaces-generates-only-one-interface-file/17395.md?page=2)

[Next page](https://talk.remobjects.com/t/codefirst-and-client-side-interfaces-generates-only-one-interface-file/17395.md?page=4)
