Hello. Some questions:

  1. Does DataObject.Net support(will support) PERSISTED Computed Columns and Indexing on them
  2. Support for sql procedures/functions mapping?

Thanks

asked Mar 25 '13 at 13:40

Ibanez's gravatar image

Ibanez
15669


One Answer:

Hello Ibanez,

  1. At the moment there is no such support. You can however create regular field and update it in OnSetFieldValue for example.

  2. It depends on what you mean by "mapping". You could write custom Expression to SQL translation. Such translated expression could utilize stored procedures. See the following example. There is no other support for stored procedures however.

answered Mar 26 '13 at 03:38

Denis%20Krjuchkov's gravatar image

Denis Krjuchkov
179325

Thanks. Could you please provide an example of 1)?

(Mar 26 '13 at 04:42) Ibanez Ibanez's gravatar image

Very simple example:

public class OrderItem : Entity
{
  [Key, Field]
  public int Id { get; private set; }

  [Field]
  public decimal Amount { get; set; }

  [Field]
  public decimal Price { get; set; }

  [Field]
  public decimal TotalPrice { get; private set; }

  protected override void OnSetFieldValue(Orm.Model.FieldInfo field, object oldValue, object newValue)
  {
    base.OnSetFieldValue(field, oldValue, newValue);
    if (field.Name=="Amount" || field.Name=="Price")
      TotalPrice = Amount * Price;
  }
}
(Mar 26 '13 at 07:36) Denis Krjuchkov Denis%20Krjuchkov's gravatar image
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

Subscription:

Once you sign in you will be able to subscribe for any updates here

Tags:

×2
×1
×1

Asked: Mar 25 '13 at 13:40

Seen: 4,594 times

Last updated: Mar 26 '13 at 07:36

powered by OSQA