I want to make a timer to check tabla status from BD each 300 miliseconds inside the same remoting sdk server, i made a Objecto of Class_Implements inside MainForm but when i go to execute a method i have connection null and ServiceSchema is not found. I want my remote methods too but i want the posibilities of make a inside timer process.
Hello
You need to use the LocalDataAdapter component. Here is the sample code:
public partial class MainForm : Form
{
private readonly INetworkServer _networkServer;
private Guid _localSessionId;
public MainForm()
{
InitializeComponent();
// Acquire local session
this._localSessionId = Guid.NewGuid();
var session = RemObjects.SDK.Server.Engine.SessionManager.GetSession(this._localSessionId);
session.Touch();
RemObjects.SDK.Server.Engine.SessionManager.ReleaseSession(session);
}
private void timer1_Tick(object sender, EventArgs e)
{
using (var adapter = new LocalDataAdapter("DataService", this._localSessionId))
{
var dataTable = new DataTable("Orders");
var condition = new BinaryExpression(new FieldExpression("Id"), 100, BinaryOperator.GreaterOrEqual); // Id >= 100
adapter.Fill(dataTable, condition, true);
// Show data request result
this.Text = DateTime.UtcNow.ToString() + ": " + dataTable.Rows.Count;
}
}
}
thanks for answer:
" ```
RemObjects.SDK.Server.Engine.SessionManager
is not recognize but i used:
var local = Engine.Instance;
this._localSessionId = Guid.NewGuid();
var session = local.SessionManager.GetSession(this._localSessionId);
session.Touch();
local.SessionManager.ReleaseSession(session);
but in adapter i get null in Schema (exception type Remobjects.DataAbstrac.DAException)
and null in Instance.Connection :confused: