Overview
There is a need to manage enterprise intranet information, including icons and links. Consider that the icon is not very large, so the picture is saved directly in the database.
But with NHibernate, how do you map it?
Table 5.5. Large Object Mapping Types
NHibernate Type |
. NET Type |
Database Type |
Remarks |
Stringclob |
System.String |
Dbtype.string |
type= "Stringclob" must be specified. Entire field is read into memory. |
Binaryblob |
System.byte[] |
Dbtype.binary |
type= "Binaryblob" must be specified. Entire field is read into memory. |
Serializable |
Any System.Object this is marked with SerializableAttribute. |
Dbtype.binary |
type= "Serializable" should be specified. The fallback type if no NHibernate type can be found for the property. |
Resolved as follows
Hara Hbm.xml
< property name = "logo" type = "byte[]" > < column name = "logo" length = "2147483647" Sql-type Span style= "color: #0000ff;" >= "image" Not-null = "false" Span style= "color: #0000ff;" >/> </ property >
< property name = "logo" type = "Binaryblob" > < column name = "logo" length = "2147483647" Sql-type Span style= "color: #0000ff;" >= "image" Not-null = "false" Span style= "color: #0000ff;" >/> </ property >
Byte[] byte arrays are still used in C # code.
Summarize
Keep track of the problems encountered in the project and record the dots.
[NHibernate] NHibernate How to map image fields in SQL Server