例如学生类
public class Student
{
public int id;
public string name;
public bool sex;
public DateTime birthday; }
教师类
public class Teacher
{
public int id;
public string name;
public bool sex;
public DateTime birthday;
public Student student;
} Student stu1=new Student();
Teacher tea1=new Teacher();
tea1.id=....
.....
tea1.student=stu1;1.这个如果用NHibernate 的Seisson.save(tea1)时候,影射文件的student列 应该是什么类型??如果不能这样保存,序列化后 // 序列化为byte[]
MemoryStream fs = new MemoryStream();
byte[] tmp = null;
BinaryFormatter formatter = new BinaryFormatter();
formatter.Serialize(fs, student);
tmp = fs.ToArray();
可以将将tmp作为bianry数据存到数据库2.影射文件的类型应该是 bianry?3.能不提供一个对象序列化后保存到SQLSEVER列子?
public class Student
{
public int id;
public string name;
public bool sex;
public DateTime birthday; }
教师类
public class Teacher
{
public int id;
public string name;
public bool sex;
public DateTime birthday;
public Student student;
} Student stu1=new Student();
Teacher tea1=new Teacher();
tea1.id=....
.....
tea1.student=stu1;1.这个如果用NHibernate 的Seisson.save(tea1)时候,影射文件的student列 应该是什么类型??如果不能这样保存,序列化后 // 序列化为byte[]
MemoryStream fs = new MemoryStream();
byte[] tmp = null;
BinaryFormatter formatter = new BinaryFormatter();
formatter.Serialize(fs, student);
tmp = fs.ToArray();
可以将将tmp作为bianry数据存到数据库2.影射文件的类型应该是 bianry?3.能不提供一个对象序列化后保存到SQLSEVER列子?
解决方案 »
- Cannot apply indexing with [] to an expression of type 'System.Data.DataRow'
- C# wpf中获取的了一个double地址,怎么转换为double啊
- SQL時間轉換問題
- 100分求powerpoint开发资料,需要2007,2003两种版本,急
- 重新问 关于JAVA NET 跨平台
- 引用Excel库的版本问题
- C#怎么写COM呀,就是能让VBScript一样的脚本调用的
- 急!!!!!!!!!如何把俩Dataset结果集放到一个DataGridView里展示
- ASP.net Web 应用程序 #if Debug 预编译
- 有关owc11的问题
- c++结构转换成c#结构遇到的问题(在线等)
- nhibernate查询原SQL的方法请高手指点啊。。。
这个调用student的序列化,再把他的哥哥元素解析直到所有内容都是value type而止
<key column="ID" />
<one-to-many class="Student,namespace" />
</bag>
这是Teacher中Student在映射文件中的形式