コード例 #1
0
ファイル: Program.cs プロジェクト: ErgEnn/NetRpc
        public async Task <Ret> Call(InParam p, int i, Stream stream, Func <int, Task> progs, CancellationToken token)
        {
            //Console.WriteLine($"{p}, {i}, {Helper.ReadStr(stream)}");

            //for (int i1 = 0; i1 < 3; i1++)
            //{
            //    progs(i1);
            //    await Task.Delay(100, token);
            //}

            //Console.WriteLine($"{p}, {i}, {Helper.ReadStr(stream)}");

            int s = 81920;

            byte[] bs        = new byte[s];
            var    readCount = await stream.ReadAsync(bs, 0, s, token);

            while (readCount > 0)
            {
                readCount = await stream.ReadAsync(bs, 0, s, token);
            }

            return(new Ret
            {
                //Stream = File.OpenRead(Helper.GetTestFilePath()),
                Stream = File.OpenRead(@"D:\TestFile\2751275008.iso"),
                P1 = "return p1"
            });
        }
コード例 #2
0
        public void AnyProc()
        {
            var param = new InParam();

            var result = Index.Execute(param);

            // ...
        }
コード例 #3
0
        public OutParam Execute(InParam param)
        {
            var inParam = Converter.ConvertToInnerInParam(param);

            var result = Index.Execute(inParam);

            return(Converter.ConvertToOuterOutParam(result));
        }
コード例 #4
0
        private static void TestPLSQL()
        {
            List <IRow> rows = OraDb()
                               .Where(InParam.Decimal("id", 4))
                               .Select()
                               .ExecuteSql("SELECT message from TEST.LOGS WHERE LOG_ID = :id");

            rows.ForEach(row => Console.WriteLine("MESSAGE: x" + row.String("MESSAGE") + "x"));
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: mingyaaaa/NetRpc
        public async Task <Ret> Call(InParam p, int i, Stream stream, Func <int, Task> progs, CancellationToken token)
        {
            Console.WriteLine($"{p}, {i}, {Helper.ReadStr(stream)}");

            for (int i1 = 0; i1 < 3; i1++)
            {
                await progs(i1);

                await Task.Delay(100, token);
            }

            return(new Ret
            {
                Stream = File.OpenRead(Helper.GetTestFilePath()),
                P1 = "return p1"
            });
        }
コード例 #6
0
        private static void TestTSQL()
        {
            Db().ExecuteInsertOrDeleteOrUpdateSQL(@"
IF OBJECT_ID('dbo.TEST_DDL', 'U') IS NULL 
CREATE TABLE [dbo].[TEST_DDL](
	[ID] [numeric](18, 0) IDENTITY(1,1) NOT NULL,
	[EVEN_XML] [xml] NULL,
	[NOTES] [nvarchar](40) NULL,
	[ASCII_NOTES] [varchar](40) NULL,
	[REMEMBER_WHEN] [datetime] NULL,
	[WHEN_TS] [rowversion] NOT NULL,
 CONSTRAINT [PK_TEST_DDL] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]");

            var ids = Db()
                      .Where(InParam.Xml("x", "<PmtInf><PmtInfId>PM51</PmtInfId></PmtInf>")
                             , InParam.String("n", "άστα να πάνε")
                             , InParam.String("an", "asta vrasta")
                             , InParam.DateTime("r", DateTime.Now)
                             //, InParam.Binary("WHEN_TS", )
                             )
                      .Select(Value.Decimal("ID"))


                      .ExecuteSql
                      //.ExecuteInsertOrDeleteOrUpdateSQL
                          (@"INSERT INTO TEST_DDL 
-- OUTPUT inserted.ID
(EVEN_XML, 
NOTES, ASCII_NOTES, REMEMBER_WHEN) 
VALUES (@x, 
@n, @an, @r);
select scope_identity() as ID;
")
                      .Select(r => r.Decimal("ID"));

            ids.ToList().ForEach(id => Console.WriteLine($"id: {id}"));
            //List<IRow> rows = Db()
            //    .Select()
            //    .ExecuteSql("SELECT [ID] FROM[dbo].[PAYINFOBLOCKS]");
            //rows.ForEach(row => Console.WriteLine(row.Decimal("ID")));
        }
コード例 #7
0
 public AnyLibrary.InParam ConvertToInnerInParam(InParam param) => new AnyLibrary.InParam();
コード例 #8
0
 public Query dbint(InParam<int> mainpkey)
 {
     return new ParamListBulider {
         mainpkey,
         this.inner1
     }.BuildQuery("dbo.testinner");
 }
コード例 #9
0
 public OutParam Execute(InParam param)
 {
     throw new NotImplementedException();
 }