This question is locked. New answers and comments are not allowed.
I've got an application with a Data Library built on Entity Framework. I am looking into using OA instead for a number of reasons, but I think I need a little guidance.
My database consists of a many-many self referencing table. The join table has a triggers to create and delete the reciprocal records when changes are made to the relationships. Because it's a self-reference I don't need both sides as navigation properties. Can OA handle this? In EF, right now I have to have both nav properties, which I don't like.
I also have a one -> zero or one relationship. Both tables have the same primary key (Primary key is also foreign key to other table). In playing around, it didn't seem that I could define this relationship in OA. it interpreted it as a one -> many. Is this okay? Can I still use it this way and if so how will it work?
I'm not sure exactly how I use enums. Once I do a populate from database and create the enum, do I just change the data type and name of my property in the designer (so that the name isn't something like DivisionID)? Do I need to pull in the lookup table as well? Can these enums be used in linq queries?
EF doesn't have a way to undo changes without calling a refresh with storewins and it doens't work on many to many relationships, so I have to do a messy workaround. I saw in the docs that OA context can undo or revert changes. How does it do this? Does it do a fetch or does it actually keep track of the changes and revert them without fetching from database?
Can my collection properties only pull in a certain list? I'm running with lazy loading off so I'm eagerly loading collections. But in my database I have an IsDeleted flag that gets set from an instead of delete trigger. I'd prefer to just pull in those items by using a linq query such as Parent.Children.Load(c=>!c.IsDeleted). with EF I'm having to get everything, then use filters in my databinding to hide/collapse anything that has been deleted in the collection.
In the future I might consider putting this model in a Data Service. I've got concurrency properties that I'd prefer not to expose on the model, so I've marked them as private properties. As it is, the EF provider requires that all properties be public, so it doesn't work. Does the OA provider have the same restriction?
Thanks for answering all my questions.
My database consists of a many-many self referencing table. The join table has a triggers to create and delete the reciprocal records when changes are made to the relationships. Because it's a self-reference I don't need both sides as navigation properties. Can OA handle this? In EF, right now I have to have both nav properties, which I don't like.
I also have a one -> zero or one relationship. Both tables have the same primary key (Primary key is also foreign key to other table). In playing around, it didn't seem that I could define this relationship in OA. it interpreted it as a one -> many. Is this okay? Can I still use it this way and if so how will it work?
I'm not sure exactly how I use enums. Once I do a populate from database and create the enum, do I just change the data type and name of my property in the designer (so that the name isn't something like DivisionID)? Do I need to pull in the lookup table as well? Can these enums be used in linq queries?
EF doesn't have a way to undo changes without calling a refresh with storewins and it doens't work on many to many relationships, so I have to do a messy workaround. I saw in the docs that OA context can undo or revert changes. How does it do this? Does it do a fetch or does it actually keep track of the changes and revert them without fetching from database?
Can my collection properties only pull in a certain list? I'm running with lazy loading off so I'm eagerly loading collections. But in my database I have an IsDeleted flag that gets set from an instead of delete trigger. I'd prefer to just pull in those items by using a linq query such as Parent.Children.Load(c=>!c.IsDeleted). with EF I'm having to get everything, then use filters in my databinding to hide/collapse anything that has been deleted in the collection.
In the future I might consider putting this model in a Data Service. I've got concurrency properties that I'd prefer not to expose on the model, so I've marked them as private properties. As it is, the EF provider requires that all properties be public, so it doesn't work. Does the OA provider have the same restriction?
Thanks for answering all my questions.