[XPost] - Visual Studio 2008 - Instruct IDE Not To Generate Adapter

  • Thread starter Thread starter Mythran
  • Start date Start date
M

Mythran

Reposted from microsoft.public.vstudio.general (no answer there)..maybe this
group can help even though it isn't language specific...I can't seem to find
any other place to post this specific question...if there is another place,
please let me know if this doesn't get an answer here.

--------------------------------------------------------------------------------------------------

Is there a way I can instruct Visual Studio 2008 to not generate the
data/table
adapters for my tables when I drag-n-drop a database table from the Server
Explorer onto the DataSet designer? We have a separate project specifically
for typed data sets and we are tired of having the designer decide that it
needs to add an app.config and Settings.settings file because of the data
adapter it is generating. We have to remove the app.config and
Settings.settings file and then manually edit the xsd file to remove the
connection settings it adds to the file. We do not use the data adapters.

Thanks,

Mythran
 
Hi Mythran,

Glad to work with you, again.

microsoft.public.vstudio.general is for VS 6.0 and older versions and it is
not in the managed newsgroup support list. You should post Visual Studio
2008 related questions to microsoft.public.vsnet.general. Sorry for any
inconvenience for it.

Visual Studio doesn't support customize the generation of data adapter.
Whenever a data table is added to dataset from database, its corresponding
data adapter is generated. I couldn't see any configuration settings to
prevent it. However it is possible to the generation of connection string
in app.config and settings.settings file.

This can be done by add New Data Source instead of dragging and dropping in
dataset designer. Following are the steps: in Visual Studio, menu Data ->
Add New Data Source... -> select Database -> select proper data connection
-> uncheck "Yes, save connection as:" -> select Tables -> name DataSet ->
Finish

If you want to edit an existing dataset, following the steps below:
in Visual Studio, menu Data -> Show Data Sources -> select target dataset
-> select Configure DataSet with Wizard -> following steps are same in Add
New Data Source.

After adding data tables, data adapter can be deleted in designer manually.
I understand it is not a complete solution for the problem, but I will
forward this limitation to proper channel.

If you have any comment or suggestion, we are very glad to hear it from
you. Have a nice day.

Best regards,
Hongye Sun ([email protected], remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within?2 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
"Hongye Sun [MSFT]" said:
Hi Mythran,

Glad to work with you, again.

microsoft.public.vstudio.general is for VS 6.0 and older versions and it
is
not in the managed newsgroup support list. You should post Visual Studio
2008 related questions to microsoft.public.vsnet.general. Sorry for any
inconvenience for it.

Visual Studio doesn't support customize the generation of data adapter.
Whenever a data table is added to dataset from database, its corresponding
data adapter is generated. I couldn't see any configuration settings to
prevent it. However it is possible to the generation of connection string
in app.config and settings.settings file.

This can be done by add New Data Source instead of dragging and dropping
in
dataset designer. Following are the steps: in Visual Studio, menu Data ->
Add New Data Source... -> select Database -> select proper data connection
-> uncheck "Yes, save connection as:" -> select Tables -> name DataSet ->
Finish

If you want to edit an existing dataset, following the steps below:
in Visual Studio, menu Data -> Show Data Sources -> select target dataset
-> select Configure DataSet with Wizard -> following steps are same in Add
New Data Source.

After adding data tables, data adapter can be deleted in designer
manually.
I understand it is not a complete solution for the problem, but I will
forward this limitation to proper channel.

Hongye Sun,

Aye, nice to see ya again...

Well, that blows that I can't "turn off" generating the TableAdapter's when
I drag-n-drop a table from the Server Explorer to the DataSet designer.
That's a new feature (at least "new" to me since that feature didn't exist
in 1.1 of the framework). Not only that, another change is that of the
DataSet's EnforceConstraints now checking max length of the fields when you
set the field values of a row. Before, MaxLength was not even
generated...so when I upgraded my apps to 3.5, I get an exception if the
user types in a field too long <grr>.

The reason for these grr moments is that I use Microsoft Patterns &
Practices Enterprise Library for our DAL (and some BLL stuff). By enforcing
the MaxLength in the UI due to EnforceConstraints, it doesn't reach my BLL
where I check the max values at. I do know I can (and have) turned off
EnforceConstraints, but it's an all or nothing setting. Either I enforce
constraints AND max length checks, or neither. Maybe there should be two
properties on the DataSet, one that enforces constraints, and one that
enforces max length? Just a thought.

Not sure if these were added in 2.0 or 3.5, I skipped 2.0 from 1.1 and went
straight to 3.5 (yeah, I know 3.5 is more an add-on major patch for 2.0).

Thanks for all your help Hongye, looking forward to chatting w/you again :)

Mythran
 
Hi Mythran,

I see what the problem is. I confirmed that we cannot change the MaxLength
setting when drag and drop in Visual Studio. By setting MaxLength, it makes
more secure when interacting with database. Currently, we have no way to
change the designer generated code. The only way to change it is either
change the designer code or change the MaxLength property in runtime. But
neither of them are suggested. Because changing designer code will be
overrided if designer is regenerated. Changing MaxLength in runtime looks
very weired and it can only be a temp workaround.

I am not familiar with Enterprise Library, so I am not sure if there is any
other better suggestions. I suggest you to post the question to EL's forum
http://www.codeplex.com/entlib/Thread/List.aspx for more complete advices.
It is possible that EL can customize its UI constraints check without
changing DataSet code.

Hope it helps. Have a nice day.

Best Regards,
Hongye Sun ([email protected], remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided.

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top