Re: [user type] User Type Deep Copy (was: [user type] VARBINARY mapping)

2 views
Skip to first unread message

Michael Powell

unread,
Jul 11, 2016, 7:17:58 PM7/11/16
to fluent-n...@googlegroups.com
On Sat, Jul 9, 2016 at 9:43 PM, Michael Powell <mwpow...@gmail.com> wrote:
> On Fri, Jul 8, 2016 at 5:08 PM, Michael Powell <mwpow...@gmail.com> wrote:
>> Hello,
>>
>> I've got a custom user type which maps to a VARBINARY. I am working on
>> the domain side of things for the moment, resolving MSB concerns for
>> consistency throughout. Now I am ready to look into the ORM mapping
>> and need to know, what does SQL Server expect?
>
> I more or less answered my own question today. I don't care about
> serializing arrays of ints, per se. Only in a byte buffer of data,
> whether the data is LSB or MSB. In my case, LSB is preferred, and I
> think I can maintain that. The key is that the data is FIFO writing to
> the database, and reading from the database. Or rather, it's
> consistent at least. It would be better if I understood if buffer[0]
> was really data[0] in the database, but I'll work with what I've got.
> Perhaps if I tried to save {0,0,0,1} versus {1,0,0,0} what it does.
> Intuitively, I would half expect that the bytes themselves are
> preserved, that is, trailing or MSB 0's are not truncated, but I could
> be wrong about this.
>
>> I read a blog or two that seemed to indicate that the byte[] that I
>> work with passing it through the user type should be MSB, but I would
>> like to understand that better, if at all possible.
>>
>> The domain model likes LSB by default, with a couple of instances
>> where I convert to MSB, but for the most part, I want to stay
>> consistent throughout, or at least have a solid understanding
>> when/where/why those conversions are necessary.

After doing some more digging, I discovered that DeepCopy is receiving
an object of the type of the thing being mapped, which I would have
half expected, but for lack of documentation.

What is less clear is what value should be returned? My guess is, in
this case, the "deep" byte[] found within the object value, but again,
for lack of documentation.

Would someone mind clarifying, does this sound accurate dealing with
DeepCopy and User Types in general?

Thank you!

>> Thank you!
>>
>> Regards,
>>
>> Michael Powell
Reply all
Reply to author
Forward
0 new messages