ibatis.net

Return result from query even if WHERE clause not met

余生颓废 提交于 2019-12-13 07:36:08
问题 I am creating a query that ensures some constraints are met. Here's a semi-working version right now: SELECT CASE WHEN TaskId IS NULL THEN 0 ELSE 1 END AS TaskExists, CASE WHEN IsDownTask = 0 AND TaskStatus = 63 THEN 1 WHEN IsDownTask = 1 THEN 1 ELSE 0 END AS PressReady, CASE WHEN IsDownTask = 1 AND MachineId <> 2710 THEN 1 ELSE 0 END AS DownTaskAssignedToDifferentMachine FROM Task T WHERE TaskId = 555555 This works fine when TaskId exists in the Task table, but I also need to return values

Using iBATIS.NET with generic custom collection interfaces and Unity

妖精的绣舞 提交于 2019-12-11 07:45:56
问题 I'm trying to use a generic custom collection interface (to support injection with Microsoft Patterns and Practices Unity) in a class O/R mapped with iBATIS.NET. Does anyone know if this is possible and if so how to do it? I have an IDataItemCollection<T> interface that I map to SqlDataItemCollection<T> which extends CollectionBase. I want to use the IDataItemCollection<T> in my classes so I can swap SqlDataItemCollection<T> with other classes that extend the interface through Unity. The

How do you map a List<string> in iBatis?

半腔热情 提交于 2019-12-06 02:47:48
问题 I have a class like this public SomeClass { private List<string> _strings = new List<string>(); public IEnumerable<string> Strings { { get return _strings; } } } How would I do the mapping for _strings? I tried this, but it complains about the List typehandler not being found, which it doesn't complain about if I mapped it as an object. <result property="_strings" column="value" /> So I searched Google and found this workaround (originally for a Java issue, no idea if it's suppose to work in

How do you map a List<string> in iBatis?

我与影子孤独终老i 提交于 2019-12-04 08:13:10
I have a class like this public SomeClass { private List<string> _strings = new List<string>(); public IEnumerable<string> Strings { { get return _strings; } } } How would I do the mapping for _strings? I tried this, but it complains about the List typehandler not being found, which it doesn't complain about if I mapped it as an object. <result property="_strings" column="value" /> So I searched Google and found this workaround (originally for a Java issue, no idea if it's suppose to work in C#) <result property="_strings" resultMapping="someMapping.StringList"/> <resultMap id="StringList"

How to serialize an IList<T>?

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-29 09:20:06
I've got an OR mapper (iBatis.Net) that returns an IList. // IList<T> QueryForList<T>(string statementName, object parameterObject); var data = mapper.QueryForList<Something>(statement, parameters); I'm trying to use it in an webservice an want to return the data 1:1. Of course I can't return IList in a WebMethod, because it is an interface and therefore not serializable. I found that the mapper is really returning an List. But I'm afraid to cast it to List because of course the mappers inner workings could change in future versions (and it just feels dirty). So should I ... a) return new List

How to serialize an IList<T>?

删除回忆录丶 提交于 2019-11-28 02:44:45
问题 I've got an OR mapper (iBatis.Net) that returns an IList. // IList<T> QueryForList<T>(string statementName, object parameterObject); var data = mapper.QueryForList<Something>(statement, parameters); I'm trying to use it in an webservice an want to return the data 1:1. Of course I can't return IList in a WebMethod, because it is an interface and therefore not serializable. I found that the mapper is really returning an List. But I'm afraid to cast it to List because of course the mappers inner