需要更快的方法来在SSIS中提取oData feed

时间:2012-12-05 22:57:55

标签: c# ssis odata sql-server-2012 script-component

是否有更快的方法来获取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++;
        }

    }

2 个答案:

答案 0 :(得分:1)

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

我希望它有用。祝好运!

答案 1 :(得分:0)

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