in theory this gives me a back end that will do persistance

to actually have something to test plumbing in appearance
saving.
0.6.0-stable
Sean Dague 2008-05-02 19:16:54 +00:00
parent 1b7f1c956c
commit 286d681673
1 changed files with 28 additions and 3 deletions

View File

@ -248,12 +248,37 @@ namespace OpenSim.Data.NHibernate
/// TODO: stubs for now to get us to a compiling state gently
override public UserAppearance GetUserAppearance(LLUUID user)
{
return new UserAppearance();
UserAppearance appearance;
// TODO: I'm sure I'll have to do something silly here
using(ISession session = factory.OpenSession()) {
appearance = session.Load(typeof(UserAppearance), user) as UserAppearance;
}
return appearance;
}
private bool ExistsAppearance(LLUUID uuid)
{
UserAppearance appearance;
using(ISession session = factory.OpenSession()) {
appearance = session.Load(typeof(UserAppearance), uuid) as UserAppearance;
}
return (appearance == null) ? false : true;
}
override public void UpdateUserAppearance(LLUUID user, UserAppearance appearance)
{
return;
bool exists = ExistsAppearance(user);
using(ISession session = factory.OpenSession()) {
using(ITransaction transaction = session.BeginTransaction()) {
if (exists) {
session.Update(appearance);
} else {
session.Save(appearance);
}
transaction.Commit();
}
}
}
override public void AddAttachment(LLUUID user, LLUUID item)