Telerik Forums RSShttps://www.telerik.com/urn:uuid:58c043e2-711f-471d-bbb5-feabe639769ahttps://www.telerik.com/forums/permalink/4kPAWB9xHUe7tf6r5jl2mgMoving from EntityFrameworkHi Rayne,
<p>Yes, defining enum type for a smallint field is allowed and usable.<br />
<br />
In case you have any issue with doing that, send us a support ticket with your domain model, enum definition and database schema attached and we will advise you how to resolve it.<br />
<br />
I am looking forward to your feedback.<br />
<br />
</p>
All the best,<br />
Ivailo <br />
the Telerik team
<div class="forumBaloonTop"></div>
<div class="forumBaloon">
<p style="margin-top: 0in; margin-right: 0in; margin-bottom: 10pt; margin-left: 0in;">NEW and UPDATED OpenAccess ORM Resources.<a title="New and Updated OpenAccess ORM Resources Available " target="_blank" href="http://blogs.telerik.com/openaccessteam/posts/11-10-20/new-and-updated-openaccess-orm-resources-available.aspx"> Check them out</a>!</p>
</div>
<div class="forumBaloonBottom"></div>urn:uuid:d968cea5-da99-4c66-b10d-e156de60dcd1https://www.telerik.com/forums/permalink/pc5o2ZnaZkyxDeFW3mDc0QMoving from EntityFrameworkThank you for the feedback. Can I map an enum that has an underlying type of short to a database field of type smallint? I'm not actually trying to update my database schema but I did try to generate the script to see what it might have updated, but it doesn't like that my enum is a short. Does it only work on int enums?urn:uuid:bbb8f554-aa5c-4cd2-9e72-771d513d7f52https://www.telerik.com/forums/permalink/VPW4u1yq0kyecncdUT1_UgMoving from EntityFrameworkHi Rayne,
<p>Thank you for your interest in OpenAccess ORM.<br />
<br />
First, let me pinpoint that we offer a <a href="http://www.telerik.com/help/openaccess-orm/developer-guide-convert-legacy-app-ef-overview.html" target="_blank">wizard </a>that automatically converts EF models to OpenAccess Domain Models. I think that it will be quite useful in your case.<br />
<br />
To get to your question:<br />
1) We offer two options for handling many-to-many relationships - you can map the join table as a separate Domain Class with two one-to-many relationships or you can simply use the navigational properties on both ends to express the relationship in your classes without having a class for the join table<br />
<br />
2) One-to-one relationship is not directly supported, you can model such relations as one-to-many or as <a href="http://www.telerik.com/help/openaccess-orm/openaccess-tasks-define-model-inheritance-vertical-mapping.html" target="_blank">vertical inheritance</a> between the classes, as described in the relevant Knowledge Base <a href="http://www.telerik.com/support/kb/orm/general/how-to-map-a-one-to-one-relationship.aspx" target="_blank">article</a>.<br />
<br />
3) Enum property types are supported by our Visual Designer and treated as the underlying value type by LINQ statements. You need to just create manually your enum and edit the selected property type in the designer.<br />
<br />
4) When you make changes to the database through the OpenAccessContext, they are cached in memory and applied to the database when you call the SaveChanges() method. If you rollback the in-memory transaction by ClearChanges(), the database is not updated.<br />
<br />
5) The navigation properties in OpenAccess ORM are fetched through lazy loading unless you specify explicitly that you want a collection to be loaded through <a href="http://www.telerik.com/help/openaccess-orm/getting-started-root-getting-started-with-fetchplans.html" target="_blank">Fetch Plans</a>. However, filtering the collections while loading them for the first time is not supported. This means that you will either load the entire list of related objects or none of them.<br />
<br />
6) Restricting the access to certain properties of OpenAccessContext exposed through a Data Service is possible with our product. If you need to configure such restriction, please revert back to us and we will explain in detail how to make the necessary changes.<br />
<br />
<br />
I hope that information answers your questions. Do not hesitate to contact us for further details.<br />
<br />
</p>
All the best,<br />
Ivailo <br />
the Telerik team
<div class="forumBaloonTop"></div>
<div class="forumBaloon">
<p style="margin-top: 0in; margin-right: 0in; margin-bottom: 10pt; margin-left: 0in;">NEW and UPDATED OpenAccess ORM Resources.<a title="New and Updated OpenAccess ORM Resources Available " target="_blank" href="http://blogs.telerik.com/openaccessteam/posts/11-10-20/new-and-updated-openaccess-orm-resources-available.aspx"> Check them out</a>!</p>
</div>
<div class="forumBaloonBottom"></div>urn:uuid:a86fb866-e270-421b-ba70-5d05d85ec955https://www.telerik.com/forums/permalink/ZrhvqHDiG0K6cF0F2F7JVQMoving from EntityFrameworkI'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. <br />
<br />
My&nbsp;database consists of a many-many self referencing table. The join table has a triggers to create and delete&nbsp;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.<br />
<br />
I also have a one -&gt; 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 -&gt; many. Is this okay? Can I still use it this way and if so how will it work?<br />
<br />
I'm not sure exactly how I&nbsp;use enums. Once I do a populate from database and create the enum, do I just change the&nbsp;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?&nbsp;Can these enums be used in linq queries?<br />
<br />
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?<br />
<br />
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=&gt;!c.IsDeleted).&nbsp;with EF&nbsp;I'm having to get everything, then use filters in my databinding to hide/collapse anything that has been deleted in the collection. <br />
<br />
In the future I might consider putting this&nbsp;model&nbsp;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? <br />
<br />
Thanks for answering all my questions.