public class A : Entity {

[Field(Nullable = false)]
public B Some {get;set;}

}

public class B : Entity {
}

When i try to get AssociationInfo for the "Some" property it shows me OnOwnerRemove = Clear, OnTargetRemove = Default. This is really wrong because, it should be OnRemoveAction.None. If I generate classes based on your metadata(don't ask why;)) then the new generated class will look like

public class A : Entity {

[Association(OnOwnerRemove = OnRemoveAction.Clear)]
[Field(Nullable = false)]
public B Some {get;set;}

}

And now when I try to remove A instance it will fail. Because DO will try to set null into "Some" and then delete it.

DO4.3 RC2


Updated at 07.07.2010 9:31:43

Не закрыта бага. Все еще при неуказанном OnRemoveAction показывается OnRemoveAction.Clear Not really fixed, Just tried RC5, and it still shows OnRemoveAction.Clear if OnRemoveAction is not specified


Updated at 08.07.2010 5:55:18

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

        [Field(Length = 100)]
        public string Text { get; set; }

        [Field]
        public MyEntity2 Link { get; private set; }
    }

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

        [Field(Length = 100)]
        public string Text { get; set; }
    }

var config = DomainConfiguration.Load("Default");
            var domain = Domain.Build(config);

            var fields = domain.Model.Types[typeof(MyEntity)].Fields;
            foreach (var field in fields.Where(f => f.Association != null))
            {
                Console.WriteLine(field + " owner: " + field.Association.OnOwnerRemove);
                Console.WriteLine(field + " target: " + field.Association.OnTargetRemove);
            }

Link (FieldInfo) owner: Clear Link (FieldInfo) target: Default

This thread was imported from our support forum. The original discussion may contain more detailed answer.

asked Jun 02 '10 at 15:34

xumix's gravatar image

xumix
425747682

Fixed, as well as few more bugs.

Please read http://code.google.com/p/dataobjectsdot ... ?id=676#c2 as well.

(Jun 02 '10 at 15:34) Alex Yakunin Alex%20Yakunin's gravatar image

One Answer:

Hmm... This must be fixed, there is even a test for this: http://goo.gl/XgZy

Actually there must be:

  • None for OnOwnerRemove

  • Deny for OnTargetRemove.

Can you check if this is what you expect?

answered Jul 07 '10 at 13:37

Alex%20Yakunin's gravatar image

Alex Yakunin
29714412

Hmm, if I add [Field(Nullable = false)] to that field - than it becomes Link (FieldInfo) owner: Clear

(Jul 07 '10 at 13:37) xumix xumix'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:

×572

Asked: Jun 02 '10 at 15:34

Seen: 2,309 times

Last updated: Jun 02 '10 at 15:34

powered by OSQA