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. FreeMarker / S2SH 各种报错解决方案

    1. org.hibernate.PropertyAccessException: IllegalArgumentException occurred while calling setter of ...

  2. 2016-06-19 NOIP模拟赛

          2016-06-19 NOIP模拟赛 by coolyangzc 共3道题目,时间3小时 题目名 高级打字机 不等数列 经营与开发 源文件 type.cpp/c/pas num.cpp/c ...

  3. proguard-project.txt和project.properties混淆代码

     [转]利用android proguard混淆代码 防止反编译,优化代码 网上虽然有很多相关博客,不过貌似都不是最新版的..于是百度+谷歌+github上的开源demo,终于成功的配置了androi ...

  4. 1105 第K大的数(二分)

    1105 第K大的数 基准时间限制:1 秒 空间限制:131072 KB 分值: 40 难度:4级算法题 数组A和数组B,里面都有n个整数.数组C共有n^2个整数,分别是A[0] * B[0],A[0 ...

  5. PLSQL 用的让自己更舒心点!

    每天开发时候  ,有时候会疲劳! 改下你的PLSQL 字体吧!

  6. JavaScript数据结构与算法-栈练习

    栈的实现 // 栈类 function Stack () { this.dataStore = []; this.top = 0; // 栈顶位置 相当于length,不是索引. this.push ...

  7. 两个offer如何做选择?年薪20万vs年薪15万

    (附注:本文转载于:http://www.eoeandroid.com/thread-296678-1-1.html) 前些天和一个年轻的朋友谈跳槽.朋友说她需要在两个offer里面做选择.一个是年薪 ...

  8. “格式化HDFS后,HMaster进程启动失败”的问题解决

    用 hadoop namenode -fromat 格式化后,用./start-hbase.sh 启动HMaster和HRegionServer,但是过几秒种后HMaster进程自动关闭,HRegio ...

  9. 003-centos搭建idea开发java

    一.jdk安装 卸载openjdk 安装jdk 配置环境变量 二.下载idea 安装:http://www.cnblogs.com/bjlhx/p/6667291.html 三.配置git http: ...

  10. springboot整合 Thymeleaf模板

    首先引入maven jar依赖 <dependency> <groupId>org.springframework.boot</groupId> <artif ...