Skip to content

Settings and activity

3 results found

  1. 25 votes
    Vote

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
    You have left! (?) (thinking…)
    3 comments  ·  EntityDAC  ·  Admin →
    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
    Anonymous shared this idea  · 
    An error occurred while saving the comment
    Anonymous commented  · 

    In other words EntityDAC should be able to emulate the concepts of triggers and stored procedures with Linq.

    An error occurred while saving the comment
    Anonymous commented  · 

    I would also like to be able to do other operations when a model is saved :

    TModel.OnSave = procedure(aModel : TModel; aTransaction : TTransaction);
    begin

    if aModel.IsBlue then aTransaction.Rollback;
    aModel.OtherEntity.MagicProp := 'Black';
    aModel.Another.Blabla := 2;
    Linq.From(TSupModel).Where(TSupModel.a = TSupModel.b).Update(TSupModel.c = TSupModel.d);
    if AnotherCondition then
    aTransaction.Commit;
    else
    aTransaction.Rollback;

    end;

    An error occurred while saving the comment
    Anonymous commented  · 

    When Saving or updating entities, it is important to validate business rules. Those are invariants, and cannot be done in multiple transactions. If I want to save a TMyEntity, I have to check that it meets some conditions that maybe are related to data in the database. For now, it is impossible to do so with EntityDAC unless we use Stored Procedures. But, the ORM goal is to decouple the database from the application. And stored procedures go against this. We should be able to define "Application" procedures with Linq.

    If I update MyModel, I have to check that AnotherModel condition is met. But now, with EntityDAC, it's not possible to do this in a single transaction. It introduces a risk of data corruption. I would like to be able to write :

    TModel.Validate := procedure(aModel : TModel; var isValid : boolean) begin

    // In a transaction
    if aModel.isBlue then ...
    if aModel.AnotherModel.AnotherProp ...
    isValid := true;

    end;

  2. 10 votes
    Vote

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
    You have left! (?) (thinking…)
    0 comments  ·  EntityDAC  ·  Admin →
    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
    Anonymous shared this idea  · 
  3. 16 votes
    Vote

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
    You have left! (?) (thinking…)
    0 comments  ·  EntityDAC  ·  Admin →
    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
    Anonymous shared this idea  ·