If you using Entity Framework, uniqueidentifier data will convert to Guid.

The value of this Guid, represented as a series of lowercase hexadecimal digits in the specified format.

If you need consistency in your application you can use one format when you get string out of Guid.

Check Guid.ToString Method (String) for available formats

There can be a place where you get guid as string from database so that will be infinity upper case. ( check stored procedures Views etc..)

To avoid this issue you have to make sure that return uniqueidentifier as it is, don't convert to varchar and also follow one stranded format when converting to string.

For other operations like comparing etc..You can use Guid operators..

 
In C#, Guid.NewGuid().ToString() returns string in lower case; and in SQL server, SELECT NEWID() returns string in upper case. Why is that?

如果要把字符串的guid转换为字节数组的话,可以先进行parse,然后再tobytearray

https://docs.microsoft.com/en-us/dotnet/api/system.guid.parse?view=netframework-4.7.2

https://docs.microsoft.com/en-us/dotnet/api/system.guid.tobytearray?view=netframework-4.7.2

guid的字节序问题

https://stackoverflow.com/questions/9195551/why-does-guid-tobytearray-order-the-bytes-the-way-it-does

uniqueidentifier in SQL becomes lower case in c#的更多相关文章

  1. 你真的会玩SQL吗?Case也疯狂

    你真的会玩SQL吗?系列目录 你真的会玩SQL吗?之逻辑查询处理阶段 你真的会玩SQL吗?和平大使 内连接.外连接 你真的会玩SQL吗?三范式.数据完整性 你真的会玩SQL吗?查询指定节点及其所有父节 ...

  2. sql中对于case when...then...else...end的写法和理解

    查询配件主数据表(tbl_part_base_info)的所有数据和配件是否有物料(物料表(tbl_material)中有配件主数据表的part_no,就表示有物料,反之,则表示没有物料),用sql中 ...

  3. Leetcode#709. To Lower Case(转换成小写字母)

    题目描述 实现函数 ToLowerCase(),该函数接收一个字符串参数 str,并将该字符串中的大写字母转换成小写字母,之后返回新的字符串. 示例 1: 输入: "Hello" ...

  4. 转载:SQL中的case when then else end用法

    SQL中的case when then else end用法 来源: http://www.cnblogs.com/prefect/p/5746624.html Case具有两种格式.简单Case函数 ...

  5. Eclipse upper case/lower case

    How do I make a lower case string in Eclipse to be upper case?Using Eclipse, I want to select a stri ...

  6. 【Leetcode】709. To Lower Case

    To Lower Case Description Implement function ToLowerCase() that has a string parameter str, and retu ...

  7. 【Leetcode_easy】709. To Lower Case

    problem 709. To Lower Case solution1: class Solution { public: string toLowerCase(string str) { stri ...

  8. LeetCode--To Lower Case && Remove Outermost Parentheses (Easy)

    709. To Lower Case(Easy)# Implement function ToLowerCase() that has a string parameter str, and retu ...

  9. 709. To Lower Case - LeetCode

    Question 709. To Lower Case Sollution 题目大意:字符串大写转小写 思路: 直接调用Java API函数 字符串转char数组,遍历数组,判断如果大写就转小写 Ja ...

随机推荐

  1. 队列实现 (双向循环链表 C++)

    队列是非常easy的.可是用数组实现可能更好点. . (事实上我认为数组在多个队列的时候更难) 然后我是第一次写双向循环链表.指向太乱了. 我这里是依照自己的想法.建立了一个头节点,一个尾节点,然后依 ...

  2. Linux 的字符串截取很有用。有八种方法。

    假设有变量 var=http://www.aaa.com/123.htm 1. # 号截取,删除左边字符,保留右边字符. echo ${var#*//} 其中 var 是变量名,# 号是运算符,*// ...

  3. 迷宫问题(java实现)

    1. public class Direction { private int x; private int y; public Direction(int x, int y) { this.x = ...

  4. 作为一名合格的JAVA程序员需要点亮那些技能树?

    以下是出现次数超过100的一些技能,大家可以做一个参考. Spring 299 MySQL 290 JavaScript 216Linux 165J2EE 151设计模式 148Struts2 138 ...

  5. 2014-08-28——移动端,触摸事件 touchstart、touchmove、touchend、touchcancel

    1.Touch事件简介在移动终端上的web页面触屏时会产生ontouchstart.ontouchmove.ontouchend.ontouchcancel 事件,分别对应了触屏开始.拖拽及完成触屏事 ...

  6. 洛谷 P2721 小Q的赚钱计划

    洛谷 这大概是我见过最水的紫题吧- 洛谷标签赞一个! 题意:你有一年时间,把10w元存银行变成更多钱,在特定时间区间内,你会有一些利息,不过不可中途退出. 直接dp:st[i]表示区间左端点,ed[i ...

  7. python并发编程&多进程(一)

    本篇理论居多,实际操作见:  python并发编程&多进程(二) 一 什么是进程 进程:正在进行的一个过程或者说一个任务.而负责执行任务则是cpu. 举例(单核+多道,实现多个进程的并发执行) ...

  8. javascript实例:点亮灯泡

    <!doctype html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  9. CentOS6.9添加环境变量

    方法一:直接运行命令export PATH=$PATH:~/.composer/vendor/bin 使用这种方法,只会对当前会话有效,也就是说每当登出或注销系统以后,PATH 设置就会失效,只是临时 ...

  10. 实验一中的OOP思想

    子类继承父类    父类中声明了接口变量   接口AB中声明了抽象方法 ab 在子类中 可以用这样通俗的语句写程序: while (!(this.termination.shouldTerminate ...