This project is read-only.

Many-to-Many relationship Uniqueness - OID (SOLVED)

Apr 13, 2013 at 8:59 PM
Suppose there is an Employee class and Project class, when there is a Many-to-many relationship, between these 2 classes, how to enforce the uniqueness of this association. That is, how to make sure that the same employee is not associated with a project twice, or how to ensure that the same project is not associated with a employee twice? Do you expose the object Id as a field/property on which we can apply a unique index? Thanks.
Apr 29, 2013 at 7:58 AM
Hello,
there is on db side the enrichment with OID field, but it is not exposed to the world. If there is a good reason to expose it, I could think about that.

On the other hand, you could manage that by yourself, add the id field with set unique index on it, as the integrity field.

Regards,
Jacek
Apr 29, 2013 at 11:25 AM
Hi Jacek,

First of all thanks for your time to respond my query. NDatabase has a lot of useful features, and I appreciate your efforts in developing and supporting it.

Personally I would prefer to use/expose the OId field, so that the users can take advantage of it. I would like to know whether Ext().GetObjectExternalOID method reads the OId from the disk or memory, i.e., in other words, when an object is read from the database, does it also retrieve the OId, so that Ext().GetObjectExternalOID can retrieve the OId from memory rather than another disk read. Please let me know.

Regarding the work around of getting the id and setting a unique index on it, I do not want to reinvent/reimplement the referential integrity in my code, as NDatabase already does it, and would like to advantage of it.

Thanks again, keep up the good work.

Regards,
Velu
Apr 29, 2013 at 3:13 PM
Hello,
yes, GetObjectExternalOID method reads the OID from the disk (the OID which is stored with object). This method returns extended oid, so the db id + object id.

The better for you I believe will be IOdb methods:
  • OID Store<T>(T plainObject) where T : class; -> whenever you store the object, the OID value is returned
  • OID GetObjectId<T>(T plainObject) where T : class; -> for any stored object you can retrieve his OID
  • object GetObjectFromId(OID id); -> you always can retrieve the stored object
Regards,
Jacek
Apr 29, 2013 at 5:18 PM
Hi Jacek,

Thanks again for your timely response.

When I use OID GetObjectId<T>(T plainObject) does it get the OId from the disk, or does every (already persisted) object in memory also have the OId in memory?

I would also like to know more about the license, as the current license LGPL does not allow static linking, do you also provide commercial license with support?

Thanks,
Velu
May 3, 2013 at 8:51 PM
OID is always connected with the disk, the only time when that could be connected with memory object is when you stored object but you haven't committed it so far (you have a possibility to rollback changes).

What do you mean by static linking ?

Thanks,
Jacek
May 6, 2013 at 5:25 PM
Hi Jacek,

Thanks again on the confirmation about the OID. I think if there is an option to fetch the OID as a property, it may be very useful to enforce other constraints or relationships. But again, it is my personal requirement, and not necessarily the same for everyone.

I wanted to create my application as a single executable, which means referencing (or rather including) your source code in my single project to produce that single executable. But, I don't think LGPL allows it.

Please let me know otherwise,

Thanks again,
Velu
May 8, 2013 at 7:10 PM
Hello everybody,
      First of all I would like to say that I find this project very interesting.
I mostly work in ASP.NET MVC projects, and I can say that having the OID of the object is a must since on a disconnected scenario you don't have access to the same instance of an object when it is posted to the server and de-serialized, so you do need some field to identify uniquely the object for updating it on the database, or at least, retrieve it, change it's data with the received version and send it back to the database.

I've also read that version 3.7 is thread safe. That's what has brought me here, as this is one requirement for me, since IIS spawns several processes that may access the database concurrently. Have you tried/tested NDatabase on such environment? If so, I would like to give it a try. I've used Eloquera DB in my latter two projects and I like very much the idea behind object databases, but I'm quite dissapointed by the fact it isn't an open source project and it lacks some features I consider fundamental on its Community Edition.

If you don't know about them I suggest that take a look to eloqueradb.com. It could give you some ideas, althought their product is mostly focused on client/server environments.

Please, could you confirm that NDatabase is ready for production environment on IIS (not heavy load...)?
I developed Membership, Role and User providers for Eloquera. If NDatabase fits my needs i will try to port them.

Hope to hear from you soon. Best Regards
May 12, 2013 at 9:38 AM
OID -> next version will have a feature which allows on exposing (mapping) oid to your classes (NDatabase 3.8, release will be today/tomorrow)

Thread safe -> yes, that's true. I did several tests regarding that.

I know Eloquera DB, but it is slightly different solution (client/server only, NDatabase is more embedded one).

Please, could you confirm that NDatabase is ready for production environment on IIS (not heavy load...)? -> yes it is ;)

I developed Membership, Role and User providers for Eloquera. If NDatabase fits my needs i will try to port them. -> would be interested to seeing that. If you could create sample app, I would like to add it to existing source base.

Regards,
Jacek
May 12, 2013 at 5:49 PM
Release done (NDatabase 3.8). Now you should easily map OID to your classes.

Regards,
Jacek