开发者

Creating an Entity Data Model from an Empty model

I may be confused here (开发者_运维技巧or over my head).

I am trying to connect to an IBM i (aka iSeries) and I want to try to use the Entity Data Model to implement this. The help I have found online has been less than helpful for me. How do I add the logic needed to interface with the .edmx file and thus be used in the rest of my application?

Most of the tutorials I have seen start by building from the database. I don't have that luxury as the IBM i is not an option to connect to. Is there any that start from scratch?


Here ...

http://msdn.microsoft.com/en-us/data/ff628199.aspx

... is an introduction video how to start from an empty model.

Note: This video is about Entity Framework 4 (in Visual Studio 2010) and focusses on using the designer tools to create the model and then to create a database (SQL Server) from this model. It doesn't explain and cover manual editing of the edmx file. I'm not sure if this is what you are really looking for.


This article seems the closest to what I am looking for. However, DB2 Connect is not a free product and has a large cost associated with purchasing the product.

Stay tuned for what I do next....


I have this working now. Setup your connection like you normally would through ADO.NET or whatever method you want. Then do the following:

DataTable dt = new DataTable();

using (iDB2DataAdapter da = new iDB2DataAdapter(cmd))
{
    da.Fill(dt);
}

var MyObjects = from i in dt.AsEnumerable() select new MyObject() 
    { 
         field1 = i.Field<string>("field1"), 
         field2 = i.Field<decimal>("field2")
    };
List<MyObject> temp = MyObjects.ToList();
return temp;

This is the basics of what was done.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜