Multi-Tier in EntityDAC

Multi-Tier in EntityDAC

Postby sonadorje » Fri 10 Mar 2017 02:37

I have modified the demo code from
http://blog.devart.com/using-dac-products-in-multi-tier-db-application-development.html?_ga=1.142920309.1984624053.1485439657


Entity VCL in the module.
Image

Client code no change.
Server code is blow:
Code: Select all
function TServerMethods.GetEmp(DeptNo: integer): TDataSet;
var
  E: IEmpExpression;
  Query: ILinqQueryable;
begin
  E := fDemoContext.Emp;
  Query := Linq.From(E).Where(E.Dept.DeptNo = DeptNo).Select;
  edsEmps.SourceCollection := EntityContext1.GetEntities(Query);
  edsEmps.Open;
  Result := edsEmps;
end;

procedure TServerMethods.DeptModify(DeptNo: integer; aDName: string; Loc: string; op_type: Integer);
var
   E: IDeptExpression;
   vQuery: ILinqQueryable;
   vDept: TDept;
begin
  case op_type of
    //insert
    0:
    begin
       // Create new entity and attach to DataContext
      // If Identity generator exist, then DeptNo will be filled
      vDept := EntityContext1.CreateAttachedEntity(TDept) as TDept;
      // Fill attributes
      vDept.DName := 'New Dept ' + IntToStr(DeptNo);
      vDept.Loc := 'New LOC';
      // Save
      vDept.Save;
    end;

    1: ;

    //update
    2:
    begin
       E := fDemoContext.Dept;
       vQuery := Linq.From(E).Where(E.Deptno = DeptNo).Select;
       vDept := EntityContext1.GetEntities(vQuery).First as TDept;
       // Modify entity attributes
       vDept.Dname := aDName;
       vDept.Loc := Loc;
        // Save changes
       vDept.Save;
    end;
    3: ;
  end;

end;
function TServerMethods.GetDept: TDataSet;
begin
  eqDept.Close;
  eqDept.LINQ.Text := 'from d in dept';
  eqDept.Open;
  Result := eqDept;
end;


When the client disconnect to server and close server mainform, two exception windows is shown.
Image
sonadorje
 
Posts: 1
Joined: Fri 10 Mar 2017 02:16

Re: Multi-Tier in EntityDAC

Postby AlexP » Mon 24 Apr 2017 09:22

Hello,

We could not reproduce the error when replacing UniDAC with EntityDAC.
Please, send us a complete server sample to support*devart*com, also specify IDE and our components versions.
AlexP
Devart Team
 
Posts: 5530
Joined: Tue 10 Aug 2010 11:35


Return to EntityDAC