algorithmic modeling for Rhino
Tags:
// Create the object we would like to work with.
Cinema cinema = new Cinema() {
Location = "Sydney",
OpenDates = new DateTime[] { new DateTime(2003, 12, 10), new DateTime(2003, 10, 3) }
};
// And here is where the magic begins...
// Store the object - no conversion required.
db.Store(cinema);
The Eloquera DB does not need the class to be marked as [Serializable] in order to be persist its instances. And there is a possibility that one of the base classes uses [NotSerialized] for some of its fields. Then, the database will respect the attribute, and will not persist such fields. Another possibility is that some of the fields are marked as readonly (a C# keyword), and they cannot be updated outside of the class' constructor. There is a way to overcome this, but it is not yet available through public methods as modification of readonly fields can have some nasty side effects in the applications.
DebuggerDisplay("({m_x}, {m_y}, {m_z})")
. would you please explain this a little further for me. i really try to understand this.
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using Eloquera.Client;
using System.Windows.Forms;
using System.Reflection;
namespace RemoteExample
{
public class my_EDB
{
[Index]
public string Group { get; set; }
[Index]
public string Type { get; set; }
[Index]
public string OriginID { get; set; }
[Index]
public string Data { get; set; }
}
public class EDB
{
private string mGroup = "testgroup";
private string mType = "testtype";
private string mOriginID = "testoriginid";
private string mData = "testdata";
[Index]
public string Group { get{return mGroup;}}
[Index]
public string Type { get { return mType; } }
[Index]
public string OriginID { get { return mOriginID; } }
[Index]
public string Data { get { return mData; } }
}
public class example
{
public static void Main(string[] args)
{
my_EDB test3 = new my_EDB()
{
Group = "MYGROUPNAME",
Type = "test1",
OriginID = "ecfd2a5c-2585-4b7d-bc4f-8a33ce0a84f6",
Data = "xxxxxxxx"
};
EDB test2 = new EDB();
EDB test4= new EDB();
Console.WriteLine("test:");
Console.WriteLine(test3.Group);
Console.WriteLine(test3.Type);
Console.WriteLine(test3.OriginID);
Console.WriteLine(test3.Data);
Console.WriteLine("-----------------------");
Console.WriteLine("test2:");
Console.WriteLine(test2.Group);
Console.WriteLine(test2.Type);
Console.WriteLine(test2.OriginID);
Console.WriteLine(test2.Data);
FieldInfo field = typeof(EDB).GetField("mGroup",
System.Reflection.BindingFlags.Instance |
System.Reflection.BindingFlags.NonPublic);
field.SetValue(test2, test3.Group);
Console.WriteLine("-----------------------");
Console.WriteLine("test2 NEU:");
Console.WriteLine(test2.Group);
Console.WriteLine(test2.Type);
Console.WriteLine(test2.OriginID);
Console.WriteLine(test2.Data);
Console.WriteLine("-----------------------");
Console.WriteLine("test3:");
Console.WriteLine(test4.Group);
Console.WriteLine(test4.Type);
Console.WriteLine(test4.OriginID);
Console.WriteLine(test4.Data);
MessageBox.Show("closewindow");
}
}
}
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by