1

有没有更快的方法来获取 ssis 的 oData?

public override void CreateNewOutputRows()
    {
        SomeEntities entities = new SomeEntities(new Uri("https://aurltomystuff.com/mywebservice.svc/"));
        string username = this.Variables.username;
        string domain = this.Variables.domain;
        string password = this.Variables.password;

        entities.Credentials = new NetworkCredential(username,password, domain);

        var tbl = from t in entities.AnEntitySetInMyService
                    select new
                    {
                        AField = t.AField,
                        AField = t.AField,
                        AField = t.AField,
                        AField = t.AField,
                        AField = t.AField,
                        AField = t.AField 

                    };
        int pageSize = 500;
        int recordCount = this.Variables.recordCount;
        int page = 0;
        while (page * pageSize < recordCount)
        {
            if ((page + 1) * pageSize > recordCount) { recordCount = tbl.Count(); }

            foreach (var t in tbl.Skip(page * pageSize).Take(pageSize))
            {
                Output0Buffer.AddRow();
                Output0Buffer.AField = t.AField ;
                Output0Buffer.AField = t.AField ;
                if (t.AField == null) { Output0Buffer.AField_IsNull = true; } else { Output0Buffer.AField = (long)t.AField ; }
                if (t.AField == null) { Output0Buffer.AField_IsNull = true; } else { Output0Buffer.AField = (DateTime)t.AField; }
                Output0Buffer.AField = t.AField;
                Output0Buffer.AField = t.AField;

            }
            page++;
        }

    }
4

2 回答 2

1

我认为没有办法,开箱即用,更快地做到这一点。我的意思是,转换可以像您的示例一样是同步的,也可以是异步的。而且您的实施非常标准。但是,如果处理需要同步转换,您别无选择,如果它可以是异步的,您可以按照以下文章中的说明进行操作:http: //msdn.microsoft.com/en-us/library/ms136133.aspx

我希望它是有用的。祝你好运!

于 2012-12-08T02:41:31.507 回答
0

尝试在 SSIS 中使用 oData 源。如果您只是提取数据,我认为它会更快。

于 2018-03-21T13:55:45.233 回答