|
StrataFrame Team
|
|
|
Group: StrataFrame Developers
Posts: 3K,
Visits: 2.5K
|
So, I guess my question is now, are you working?
First off, some clairification. The Business Object Mapper is only used for design-time creation of the business objects. Once the partial class is built for the business object, the Business Object Mapper ceases to do anything for you. It does not tell the application what table to talk to at runtime; that's your job.
Scott is correct... you have to have the OracleDataSourceItem in the collection at runtime. You can do this one of two ways: you can add your parameters to the ConnectionManager through the AddRequiredConnection() method and the ConnectionManager will show the wizard at runtime, the wizard then takes care of adding the OracleDataSourceItem to the collection. Or, you can add the OracleDataSourceItem to the DataLayer.DataSources collection manually...
The DataSources collection on the DataLayer class specifies the application wide collections at runtime. So, the Business Object Mapper creates the structure of the business object at design-time, while the DataSources collection tells the business object what database to talk to at runtime.
In the code that you pasted in, you have the ConnectionManager.AddRequesteDataSourceItem() method adding a SQL Server required data source... This tells the ConnectionManager, that when you call the SetConnections() method, it needs to configure a SQL Server connection. What you need to do is comment out the SQL Server data source item and un-comment out the Oracle data source item. OR, you can add the OracleDataSourceItem you need manually (which is what the commented code below the ConnectionManager.SetConnections() method is used for.
To answer your last question: where is the connection information stored, it's stored in two encrypted files in the C:\Documents and Settings\All Users\Application Data\MicroFour\ConnectionData folder. When you make the call to ConnectionManager.SetConnections(), it looks at the calls you made to AddRequiredDataSourceItem and decides "hey, the application needs an Oracle connection." It then looks at the files in the folder mentioned above to see if the end-user has already configured this connection. If it doesn't find the information in the files, it pops up the wizard... hence why you saw the wizard when you entered a new data source key.
So, the template creates the calls you need to AddRequiredDataSourceItem. You have to customize them for the database that you need. Hopefully this gets your quesions answered.
|
|
|
|
|
John Frankewicz
|
|
|
Group: Forum Members
Posts: 36,
Visits: 65
|
I needed to add a unique key and then when I ran the application I got a wizzard. I don't get a runtime exception, but I don't understand the wizzard and I assume this wizzard is a one-time think, which brings about the question where are the username and password stored?
|
|
|
|
|
Scott
|
|
|
Group: Forum Members
Posts: 176,
Visits: 1.5K
|
My guess would be that all you need to do is fill in the database name in the 4th parameter. //ConnectionManager.AddRequiredDataSourceItem("", "Oracle Connection", // DataSourceTypeOptions.Oracle, "", "This connection is used by WindowsApplication1.");
|
Hope this helps\works.
|
|
|
|
|
John Frankewicz
|
|
|
Group: Forum Members
Posts: 36,
Visits: 65
|
Addition information from the previous post. I don't see the Oracle Connection filled out. I THOUGHT that after I did the Business Object mapping all all was done,? So it looks like my exception is being caused by not having the proper hooks to oracle? Need some guidance very bad  //------------------------------------// Using the Connection Manager//------------------------------------//-- Set the information specific to this application and the data sources// The application key:ConnectionManager.ApplicationKey = "WindowsApplication1";ConnectionManager.ApplicationDefaultTitle = "WindowsApplication1 Connection";ConnectionManager.ApplicationDefaultDescription = "This application connection is used by WindowsApplication1";//-- Set the required data source information so that the ConnectionManager can gather it// SQL ConnectionConnectionManager.AddRequiredDataSourceItem("", "SQL Connection",DataSourceTypeOptions.SqlServer, "MyDatabase", "This connection is used by WindowsApplication1.");// Oracle Connection//ConnectionManager.AddRequiredDataSourceItem("", "Oracle Connection", // DataSourceTypeOptions.Oracle, "", "This connection is used by WindowsApplication1.");// Access Connection//ConnectionManager.AddRequiredDataSourceItem("", "Access Connection", // DataSourceTypeOptions.MicrosoftAccess, "", "This connection is used by WindowsApplication1.");// FoxPro Connection//ConnectionManager.AddRequiredDataSourceItem("", "Visual Fox Pro Connection", // DataSourceTypeOptions.VisualFoxPro, "", "This connection is used by WindowsApplication1.");//-- Make the call to SetConnections which will gather the connection information, show the connection wizard// if needed and set the DataSources collection on the DataLayer class.ConnectionManager.SetConnections();
|
|
|
|
|
Scott
|
|
|
Group: Forum Members
Posts: 176,
Visits: 1.5K
|
Did you make the required changes in the appmain.cs file in private static void SetDataSources()//ConnectionManager.AddRequiredDataSourceItem("", "Oracle Connection", // DataSourceTypeOptions.Oracle, "", "This connection is used by WindowsApplication1.");
|
|
|
|
|
John Frankewicz
|
|
|
Group: Forum Members
Posts: 36,
Visits: 65
|
I understand. I have Oracle Client installed. I can connect to a remote database using Oracle tools and your mapper finds the tables. So the next mental block, I have is filling the Business object. In parent form loading I used the ParentFormLoading event to query the database using a FillDataTable. I am geting an exception at runtime: {"Cannot open database \"MyDatabase\" requested by the login. The login failed.\rLogin failed for user 'YOUR-72486D6880\\hp1'."} I assumed that since the business object was mapped to the table in the database that all I had to do was a query. I am missing something, but not sure what?
|
|
|
|
|
StrataFrame Team
|
|
|
Group: StrataFrame Developers
Posts: 3K,
Visits: 2.5K
|
Hehe, yes the SQL Server node is completely misleading... I'll change that. As for the missing delimiters, you're namespaces do not match on your designer file and you're main code file, so the two files cannot see each other. Make sure that the configuration in the Business Object Mapper has the correct namespace for the business object and re-build the partial class. Here's another topic where other users were getting the same problem: http://forum.strataframe.net/Topic52-6-1.aspxAs for the root of this problem, we're working on removing the namespace completely from the Business Object Mapper so you won't have to specify it, and the BOM will just use the same namespace as the main code file. As for the System.Data.OracleClient issue, no, we do not change the references for the project. The StrataFrame Windows Application template defaults to SQL Server, so the reference to System.Data.OracleClient needs to be added (I believe that it requires Oracle's Client software version 9.something to be installed on the computer before you can run, but I'm not positive on that.)
|
|
|
|
|
John Frankewicz
|
|
|
Group: Forum Members
Posts: 36,
Visits: 65
|
Create a Strataframe project and add a business object to it. Map the business object to an Oracle database. You get a select oracle table, but at the root node it has SQL server, and under that it has the tables of the database instance. Should the SQL server be named oracle, it is misleading. You build a partial class and everything is ok. You try to build and you get the following error: Error 1 The name 'InitializeComponent' does not exist in the current context C:\VSPrjs\MedSelect.Oncology.Login\MedSelect.Oncology.Login\LoginBusiness.cs 24 13 MedSelect.Oncology.Login
This is a new solution, not one based from previous version. Other errors: Error 4 The name 'LoginBusiness_CheckRulesOnCurrentRow' does not exist in the current context C:\VSPrjs\MedSelect.Oncology.Login\MedSelect.Oncology.Login\LoginBusiness.Designer.cs 42 83 MedSelect.Oncology.Login
Error 7 The type or namespace name 'OracleClient' does not exist in the namespace 'System.Data' (are you missing an assembly reference?) C:\VSPrjs\MedSelect.Oncology.Login\MedSelect.Oncology.Login\LoginBusiness.Designer.cs 1014 72 MedSelect.Oncology.Login
I just assumed all references would be placed since you selected oracle. Am I doing something or is it an issue that needs fixed?
|
|
|
|