本文整理汇总了C#中SqlQuery.SelectByKey方法的典型用法代码示例。如果您正苦于以下问题:C# SqlQuery.SelectByKey方法的具体用法?C# SqlQuery.SelectByKey怎么用?C# SqlQuery.SelectByKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SqlQuery
的用法示例。
在下文中一共展示了SqlQuery.SelectByKey方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SqlIgnoreAttributeTest
public void SqlIgnoreAttributeTest()
{
var da = new SqlQuery();
var p = (Person)da.SelectByKey(typeof(Person), 1);
Assert.IsNull(p.Gender);
}
示例2: Test
public void Test()
{
var da = new SqlQuery();
var p = (Person)da.SelectByKey(typeof(Person), 1);
Assert.AreEqual("Pupkin", p.Name.LastName);
}
示例3: FindById
public Doctor FindById(int id)
{
using (var db = new DbManager())
{
var query = new SqlQuery<Doctor>();
return query.SelectByKey(id);
}
}
示例4: FindById
public Patient FindById(int id)
{
using (var db = new DbManager())
{
var query = new SqlQuery<Patient>();
return query.SelectByKey(id);
}
}
示例5: GenericsTest
public void GenericsTest()
{
using (DbManager db = new DbManager())
{
SqlQuery<Person1> sq = new SqlQuery<Person1>(db);
sq.Extensions = TypeExtension.GetExtensions(@"XmlExtension.xml");
Assert.IsNotNull(sq.Extensions["Person1"]);
Person1 ps = sq.SelectByKey(1);
Assert.IsNotNull(ps);
}
}
示例6: Test
public void Test()
{
using (DbManager db = new DbManager())
{
SqlQuery sq = new SqlQuery(db);
sq.Extensions = TypeExtension.GetExtensions(@"XmlExtension.xml");
Assert.IsNotNull(sq.Extensions["Person1"]);
Person1 ps = (Person1)sq.SelectByKey(typeof(Person1), 1);
Assert.IsNotNull(ps);
}
}
示例7: Test
//[Test]
public void Test()
{
using (var db = new TestDbManager(ProviderName.Firebird))
{
var p = db
.SetCommand(@"
SELECT
t1.ParentID,
t1.Value1
FROM
Parent t1
LEFT JOIN (
SELECT
t3.ParentID as ParentID1,
Coalesce(t3.ParentID, 1) as c1
FROM
Child t3
) t2 ON t1.ParentID = t2.ParentID1
WHERE
t2.c1 IS NULL")
.ExecuteList<Parent>();
var p1 = p.First();
Assert.AreEqual(1, p1.ParentID);
var da = new SqlQuery();
var pr = (Person)da.SelectByKey(typeof(Person), 1);
Assert.AreEqual("Pupkin", pr.LastName);
//Assert.AreEqual(1, p.ID);
}
}
示例8: SelectBlob
public void SelectBlob()
{
using (var db = _connectionFactory.CreateDbManager())
{
var query = from n in db.GetTable<static_nav_session>()
where n.ID_STATIC_NAV_SESSION == 102959
select n;
var res = query.ToList();
var sqlQuery = new SqlQuery(db);
var element = sqlQuery.SelectByKey<static_nav_session>(102959);
//var blob = element.STATIC_NAV_SESSION;
//byte[] buffer = new byte[blob.Length];
//blob.Read(buffer, 0, buffer.Length);
byte[] buffer = element.STATIC_NAV_SESSION;
var dateMedia = JsonConvert.DeserializeObject<DataMedia>(Encoding.UTF8.GetString(buffer));
Console.WriteLine(dateMedia);
//MemoryStream memoryStream = new MemoryStream(buffer);
//BinaryFormatter binaryFormatter = new BinaryFormatter();
//var dede = binaryFormatter.Deserialize(memoryStream);
//Console.WriteLine(dede);
Console.WriteLine(element);
Console.WriteLine(res.Count);
}
}