_Samples/Example_NamedQuery.cs
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Data;
using System.Data.Common;
using ComLib.Entities;
using ComLib.Account;
using ComLib;
using ComLib.Application;
using ComLib.NamedQueries;
namespace ComLib.Samples
{
/// <summary>
/// Example for the NamedQueries namespace.
/// </summary>
public class Example_NamedQuery : App
{
//private string _creationType = "factory_service";
/// <summary>
/// Initialize.
/// </summary>
public Example_NamedQuery()
{
}
/// <summary>
/// Run the application.
/// </summary>
public override BoolMessageItem Execute()
{
var query = new NamedQuery();
query.Name = "Top 10 blog posts";
query.Description = "Popular blog posts";
query.ItemType = "text";
query.Roles = "admin";
query.Sql = "select top 10 from blogposts order by AvgRating desc";
query.AddParameters(new List<NamedQueryParam>() { new NamedQueryParam(){ Name = "Count", DefaultValue = "10", IsRequired = false, Typ = typeof(int).Name }});
NamedQuery.Create(query);
// To Run the query and get the results table.
// TO_DO: Not implemented yet.
// NamedQuery.Execute("top 10 blog posts");
return BoolMessageItem.True;
}
/// <summary>
/// Configure the ActiveRecord for Accounts
/// NOTES: - All service objects can be constructed with a repository, validator, settings object.
后面还有 11 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
