dapper

Using Dapper and Postgresql - citext data type

五迷三道 提交于 2021-02-07 21:49:01
问题 I'm not sure if there is a way to support this, but I'm having trouble getting Dapper to map string parameter values to the Postgresql citext data type as it seems to be using the text type. In particular, I'm trying to call a function that takes in citext parameters - the error I get back is: var c = ConnectionManager<T>.Open(); string sql = @"select * from ""dbo"".""MyFunction""(@schemaName, @tableName);"; var param = new { schemaName = schema, tableName = table }; string insecureSalt = c

Using Dapper and Postgresql - citext data type

雨燕双飞 提交于 2021-02-07 21:48:05
问题 I'm not sure if there is a way to support this, but I'm having trouble getting Dapper to map string parameter values to the Postgresql citext data type as it seems to be using the text type. In particular, I'm trying to call a function that takes in citext parameters - the error I get back is: var c = ConnectionManager<T>.Open(); string sql = @"select * from ""dbo"".""MyFunction""(@schemaName, @tableName);"; var param = new { schemaName = schema, tableName = table }; string insecureSalt = c

Dapper Order By

五迷三道 提交于 2021-02-07 14:16:36
问题 Is there any reason why the following code wouldn't be retrieved in the correct order when using dapper? connection.Query<User>("SELECT id, name " + "FROM user " + "ORDER BY @sort @dir " + "LIMIT @offset, @pageSize; ", new { sort = sortOrder, // sortOrder = "name" dir = sortDirection, // sortDirection = "ASC" offset = pageIndex * pageSize, // offset = 0 pageSize = pageSize // pageSize = 10 }); It always returns without applying the ordering. I could just place the sortOrder and sortDirection

Why DapperRow.GetType() return null?

心已入冬 提交于 2021-02-07 09:10:39
问题 As far as I knew, Object.GetType() should never return null. (related discussion) Dapper .Query() return private class DapperRow instances to be treated as dynamic objects. I found a strange thing: DapperRow's .GetType() return null. Here's the sample code to reproduce the problem. Create a C# project, reference Dapper and open a connection to SQL Server (or other database), use .Query() to execute simple select query and retrieve the first row of result. Use GetType() to get the type of

Mapping private attributes of domain entities with Dapper dot net

那年仲夏 提交于 2021-02-06 11:53:01
问题 In most of my projects I use nHibernate + Fluent mapping and recently I've started to play around with Dapper to see if I can move read operations to it. I follow DDD approach so my domain entities do not have any public setters. For example: public class User { private int _id; private string _name; private IList<Car> _carList; protected User(){} // Fluent Mapping public User(string id, string name) { // validation // ... _id = id; _name = name; } public int Id{ get {return _id;} } public

Mapping private attributes of domain entities with Dapper dot net

半腔热情 提交于 2021-02-06 11:52:54
问题 In most of my projects I use nHibernate + Fluent mapping and recently I've started to play around with Dapper to see if I can move read operations to it. I follow DDD approach so my domain entities do not have any public setters. For example: public class User { private int _id; private string _name; private IList<Car> _carList; protected User(){} // Fluent Mapping public User(string id, string name) { // validation // ... _id = id; _name = name; } public int Id{ get {return _id;} } public

How to use Dapper to automatically map remaining columns to dictionary?

青春壹個敷衍的年華 提交于 2021-02-05 07:11:25
问题 I am attempting to use Dapper to map to my DTO: public class MyDto { public int Id { get; set; } public string Code { get; set; } public IDictionary<string, object> AdditionalColumns { get; set; } } I can have an instance of MyDto populate the first two properties based on convention, but I'm not sure how to tell Dapper to map all remaining columns into the dictionary. connection.Query<MyDto>("Get_Something", commandType: CommandType.StoredProcedure, param: parameters); The stored procedure

How to use Dapper to automatically map remaining columns to dictionary?

家住魔仙堡 提交于 2021-02-05 07:11:16
问题 I am attempting to use Dapper to map to my DTO: public class MyDto { public int Id { get; set; } public string Code { get; set; } public IDictionary<string, object> AdditionalColumns { get; set; } } I can have an instance of MyDto populate the first two properties based on convention, but I'm not sure how to tell Dapper to map all remaining columns into the dictionary. connection.Query<MyDto>("Get_Something", commandType: CommandType.StoredProcedure, param: parameters); The stored procedure

微服务链路追踪

 ̄綄美尐妖づ 提交于 2021-02-04 19:02:54
1、服务追踪作用 1)优化系统瓶颈:通过记录调用经过的每一条链路上的耗时,我们能快速定位整个系统的瓶颈点在哪里 2)优化链路调用:通过服务追踪可以分析调用所经过的路径,然后评估是否合理。比如一个服务调用下游依赖了多个服务,通过调用链分析,可以评估是否每个依赖都是必要的,是否可以通过业务优化来减少服务依赖。 3)生成网络拓扑:通过服务追踪系统中记录的链路信息,可以生成一张系统的网络调用拓扑图,它可以反映系统都依赖了哪些服务,以及服务之间的调用关系是什么样的 2、原理 通过一个全局唯一的 ID 将分布在各个服务节点上的同一次请求串联起来,从而还原原有的调用关系,可以追踪系统问题、分析调用数据并统计各种系统指标 可以说后面的诞生各种服务追踪系统都是基于 Dapper 衍生出来的,比较有名的有 Twitter 的Zipkin、阿里的鹰眼、美团的MTrace traceId :是用于串联某一次请求在系统中经过的所有路径 spanId: 是用于区分系统不同服务之间调用的先后关系 annotation: 是用于业务自定义一些自己感兴趣的数据,在上传 traceId 和 spanId 这些基本信息之外,添加一些自己感兴趣的信息 来源: oschina 链接: https://my.oschina.net/u/2610056/blog/3043007

喜报!中国移动云能力中心收获一名Apache SkyWalking Committer

一笑奈何 提交于 2021-02-03 14:44:09
友情提示:全文1000多文字,预计阅读时间5分钟 来自中国移动云能力中心云计算产品部PaaS平台产品组的工程师刘唯一被Apache SkyWalking的PMC投票成为新的committer! Apache SkyWalking是什么 SkyWalking是一个APM(应用程序性能监视器)系统,专门为微服务、云原生和基于容器(Docker/Kubernetes/Mesos)的体系结构而设计。 SkyWalking可以用来做什么 在大型网站系统设计中,随着分布式架构,特别是微服务架构的流行,我们将系统解耦成更小的单元,通过不断的添加新的、小的模块或者重用已经有的模块来构建复杂的系统。随着模块的不断增多,一次请求可能会涉及到十几个甚至几十个服务的协同处理,那么如何准确快速的定位到线上故障和性能瓶颈,便成为我们不得不面对的棘手问题。Google在论文《Dapper, a Large-Scale Distributed Systems Tracing Infrastructure》中提出了分布式跟踪系统的设计和构建思路。在这样的背景下,Apache SkyWalking创建于2015年,2019年毕业成为Apache顶级项目。它参考Dapper论文实现分布式追踪功能,并逐渐进化为一个完整功能的Application Performance Management系统,用于追踪