The use of BDC columns in lists is a powerful out-of-the-box feature. But what if you want to do it your way and make your own custom BDC user control, or custom BDC Web Part ?If you need access to data in another system programatically to populate various controls, drop down lists etc. to be used in various pages of your MOSS 2007 site, then the BDC will help you to do just that. If you are working on custom ASP.NET user controls and using them in MOSS 2007 Page Layouts like I am you need to make use of MOSS APIs and assemblies.
I want to programatically access data in a SQL 2000 Database using the BDC!
So I checked out the MOSS 2007 SDK and followed this example http://msdn2.microsoft.com/en-us/library/ms560143.aspx
following the example I will populate a DataTable with 2 string DataColumns, Town and the Region the town falls within. I have already created the BDC Application Definition to return the Town data from the external system. The following classes (and their properties or methods) will be used to retrieve this data and get it into my DataTable.
ApplicationRegistry
GetLobSystemInstances()
NamedLobSystemInstanceDictionary
LobSystemInstance
GetEntities()
Entity
GetFinderFilters()
FindFiltered ( FilterCollection, LobSystemInstance )
FilterCollection
IEntityInstanceEnumerator
MoveNext()
Current
NamedLobSystemInstanceDictionary sysInstances = ApplicationRegistry.GetLobSystemInstances();LobSystemInstance warehouseInstance = sysInstances["WarehouseListDataInstance"];Entity town = WarehouseListDataInstance.GetEntities()"Town"];FilterCollection fc = town.GetFinderFilters();IEntityInstanceEnumerator townEntityInstanceEnumerator = town.FindFiltered(fc, warehouseInstance);while (townEntityInstanceEnumerator.MoveNext()) { DataRow row = dt.NewRow();
IEntityInstance IE = townEntityInstanceEnumerator.Current;
row["Town"] = IE["Town"].ToString();
row["Region"] = IE["Region"].ToString();
dt.Rows.Add(row); }
Now I have access to the data I need to use in my User Control.
BUT... I could have also got that data by :
1. Hard coding it somewhere, saves time but then you have 2 lists and 2 places to keep data synchronised, depends on the data. (this is may also get you busted and some may shower you with curses)
2. ADO.NET it still works and I can still use it in my user control, it may actually be faster to use ADO.NET (hehe). You can still use the classes you all love and have been using for years instead of learning something new. (hey, it takes TIME to learn new stuff!)
In comparison to using ADO.NET,
All the backend system connection strings and actual method used to access the backend external data is all within that XML file, the BDC Application Definition file you either hand crafted or used some tool to create.
This provides a programming experience where you access that data through MOSS 2007.
Check out the MOSS 2007 SDK for more http://msdn2.microsoft.com/en-us/library/ms549009.aspx
Subscribe to:
Post Comments (Atom)
4 comments:
If you want BDC functionality in WSS 3.0 and MOSS standard edition you should look at MashPoint.
http://community.bamboosolutions.com/blogs/mashpoint/archive/2008/06/02/mashpoint-how-does-it-work.aspx
/Jonas
WOW - MashPoint looks great!
Why did you decide to develop something like MashPoint, what's wrong with the regular BDC? What value does MashPoint add?
You Bamboo guys are really coming up with some great solutions, I love that Vista install hack =oP
Sezai,
Nothing is wrong with the BDC, we want BDC functionality in WSS and MOSS Enterprise too, that's why we built MashPoint.
Going forward we will do things that the BDC can't like allowing you to associate Entities between different LobSystems and access REST based WebServices, connect to your DomainModels (among other things).
If you are targeting the BDC today we encourage you to use the MashPoint API's instead of the MS ones, since then your solutions will run on both the BDC and MashPoint and thus you can run them on all versions of SharePoint from plain WSS up to MOSS Enterprise.
It's also very easy to write custom data providers for MashPoint, you can look at a sample file system provider here:
http://community.bamboosolutions.com/blogs/mashpoint/archive/2008/06/06/writing-a-custom-data-provider-for-mashpoint.aspx
Please leave feedback on our community site since we really want to know what features people want next.
Thanks
/Jonas
Wow - that does look good and solves a lot of the problems with the BDC such as its inflexibility and limited extensibility.
The other option people have is to write their own protocol handlers, that looks like an extremely tough bit of work though so its great that there are other easier options out there like MashPoint.
I'll try and download a copy and try it out when I have time.
Post a Comment