InlineSource

Use for declare data source locally and expose to commands via Context.

1
2
3
<basis core="inline">
   [...]
</basis>

Important

The inline command inherit from Source Commands base class and at last must have a member tag.

Remarks

By using inline command, you can inject data as hard-code to document. This command useful for add static data source to program that not need to load from data providers like Sql-Server. Like Other Source Commands, loaded data source accessible from Context.

Note

For more information about providers, see Data Providers.

For example, suppose want to display season’s name in a list. We must do this in two phase. First, write a Print Command command for make and display list. Second, provide data for use in print command in rendering process. A print command must be some things like this:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
<basis core="print" >

   <layout>
     <ul>
         @child
     </ul>
   </layout>

   <face>
     <li>@name</li>
   </face>

</basis>

Note

For more information about print Command, see Print Command.

In print command, for @name field in each data item, create li tag. Finally all created li, surrounded with a ul tag. After write command, we need data to start rendering process. Ours data source must be somethings like this:

seasons

id

name

1

Spring

2

Summer

3

Autumn

4

Winter

There are many way to load this data to Context. One way is Store this data in some database and then load it to context with DbSource. This way is not elegant, because usually there are many static data source like this in a web site and we must create many table -or something’s like it- in database for store unchangeable and simple data.

Best way for add this type of data id them as const or static data source to code. With inline command we can do this.

Table Data

You can add Data source in xml format. For example, seasons table and present in xml format like this:

1
2
3
4
<row id="1" name="Spring"/>
<row id="2" name="Summer"/>
<row id="3" name="Autumn"/>
<row id="4" name="Winter"/>

Now add this xml as raw-content to member tag of inlinesource command:

1
2
3
4
5
6
7
8
<basis core="inlinesource" name="inline">
   <member name="seasons">
      <row id="1" name="Spring">
      <row id="2" name="Summer">
      <row id="3" name="Autumn">
      <row id="4" name="Winter">
   </member>
</basis>

Default value for type attribute of member tag is table, but For add xml content as table to inlinesource command, you can set this attribute it to table. So previous command is equal this:

1
2
3
4
5
6
7
8
<basis core="inlinesource" name="inline">
   <member name="seasons" type="table">
      <row id="1" name="Spring">
      <row id="2" name="Summer">
      <row id="3" name="Autumn">
      <row id="4" name="Winter">
   </member>
</basis>

Note

For more information about MemeberType enum, see MemberType.

Generated result is:

1
2
3
4
5
6
<ul>
   <li>Spring</li>
   <li>Summer</li>
   <li>Autumn</li>
   <li>Winter</li>
</ul>