ForLogic.Prevalence
FAQ (Frequently Asked Questions)

1 - Licensing
2 - May I specify conditions to save an object?
2.1 - How to create a unique value? (Primary Key)
2.2 - How to verify if an object already exists?
3 - What happens if I got a saved object, modified and saved it again, the other objects that references it will be updated?
4 - What happens if I got a saved object, modified and don't save it again?

1 - Licensing
ForLogic.Prevalence is under the BSD License, what means you can copy, modify and redistribute it anyway you want. You can see this license below :

ForLogic.Prevalence - a Bamboo.Prevalence access layer
Copyright (c) 2005, ForLogic Softwares
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Contact Information
http://flprevalence.sourceforge.net

2 - May I specify conditions to save an object?
Yes, you can. At the namespace "ForLogic.Prevalence.Conditions" you have some defined conditions.

2.1 - How to create a unique value? (Primary Key)
The condition that you should use to create a unique value (as primary key) is ConditionUnique, and you can use it this way:

User user = new User("userlogin", "userpass", "user name");
ConditionUnique cu = new ConditionUnique("Exception Message", user, "Login");
Prevalence.save(cu, user);
			

2.2 - How to verify if an object already exists?
The condition that you should use to verify if another object exists when you save yours, is ConditionExists, and you can use it this way:

Order order = new Order(client, product, DateTime.Today);
ConditionExists ce = new ConditionExists("The client isn't saved", true, order.Client);
Prevalence.save(ce, order);
			

3 - What happens if I got a saved object, modified and saved it again, the other objects that references it will be updated?
Yes. All objects that references the one you modified will be modified too, and when you load them again they'll be updated.

4 - What happens if I got a saved object, modified and don't save it again?
This is a real problem. While your software is running, it'll keep the modifications you did at the object, even if you didn't save it, just because you're working with references, and not clones. It means if you modified the state of an object, this object will be with that state until you restart the Prevalence. A solution is to work with clones, but you can get other problems. If someone have an idea of how to do it easily, please contact.

Contact
ForLogic Softwares
Diogo Arenhart Marinho (diogoforlogic.com.br)
Jeison Arenhart De Bastiani (jeisonforlogic.com.br)