Small width layout Medium width layout Maximum width layout Small text Medium text Large text
     Search
Downloads Downloads Directory Directory Forums Forums Forge Forge Blogs Blogs        Marketplace Marketplace Careers Program Careers
Community › Forums Register  |  

AppTheory specializes in solutions based on the DotNetNuke platform and has 2 employees on the DotNetNuke Core Team.
  Ads  
Active Modules -- Active Forums for DotNetNuke
 


  Sponsors  

Meet Our Sponsors

Webhost4life, specialists in DNN hosting
Mad Development is a full service interactive agency focusing on the merge of design, technology, e-commerce, and affiliate marketing by providing total website solutions.
SteadyRain
DataSprings - Great Ideas. Always Flowing.
R2integrated - formerly bi4ce
Jango Studios - Skins, Modules and Hosting for DotNetNuke
 


DotNetNuke Forums
 
  Forum  General DotNetN...  Extend It! ( Pr...  Adding many users programmatically.
Previous Previous
 
Next Next
New Post 3/1/2007 8:56 PM
User is offline Joe Fallon
7 posts
10th Ranked


Adding many users programmatically. 

Ok Hi everyone,

I have searched the forums for something like what Im trying to do.  However have not been able to find anything. 

 

What I am trying to do is upload many users from a csv file.  I have a seperate user table from the DNN table.  But I need to populate both tables from an upload program I have written.  This is just the way the system I am building needs to run.

My users table control permissions to edit/view pages I have created.  And the Dnn user table controls DNN.  But I need the same users in both tables And I don't want to have to do separate uploads.

I am looking at building my own module to handle both uploads.  Is this tthe best course of action.  Or can I keep the upload separate (in one of my pages)  from DNN which is run from within DNN?

Thanks guys any help is greatly appreciated.

Joe.

 

 

 
New Post 3/2/2007 7:33 PM
User is offline Jim Bonnie
117 posts
www.walkspoiled.com
9th Ranked






Re: Adding many users programmatically. 

I would do this in a DNN module to get easier access to the core routines (usercontroller). I do something similar, loading DNN users from another database. This allows me to use the built in DNN roles and permissioning.

You can load your users in a loop and check if they exist, if not add them.

 

Dim createStatus As UserCreateStatus = UserController.CreateUser(User)

Jim www.walkspoiled.com
 
New Post 3/3/2007 4:05 AM
User is offline Vladan Strigo
505 posts
Vladan.Strigo.NET
8th Ranked




Re: Adding many users programmatically. 

I wouldn't...

One of the biggest problems of ALL dnn intensive routines (file sync., search indexing, portal templates) is that mostly they for batch inserts they use existing api, which often ends up by doing hundreds or more db calls and with any more serious project your things start to timeout and brake (not that dnn api is bad... but often it's not made for batch actions).

I would advise you to make a specialized batch insert routine (especially if you can use ado.net 2.0 which is more optimized for that and can do it async) and then mimic the dnn create user logic.

 

 


Thanks,
Vladan Strigo
NETMedia

My website: Vladan.Strigo.NET

Vladan.Strigo.NET: Projects
* Advanced VS2005 development approach - BlankModule
* DNN & Microsoft Ajax best practices guidance

Vladan.Strigo.NET: Resources
* Comprehensive list of DNN 4 Module development resources

 
New Post 3/3/2007 9:29 AM
User is offline Michael Washington
2842 posts
ADefWebserver.com
5th Ranked










Re: Adding many users programmatically. 

If you need to do a one-time load of users then of course you can use any method you want. However, The data layer changes constantly. We continue to make changes to tables and stored procedures for performance gains and to add functionality.

We protect the API (and when we cant we announce a breaking change) but the database layer is changed at will.

So for this reason I recommend that developers always use the API and never address Core stored procedures or tables directly.

Now for a one-time load this may not be an issue, but if you run the same program you had working on another version of DotNetNuke you could corrupt your database because we changed a table or stored procedure. Or worse, you thought it worked and the problems show up later when some users suddenly have Admin powers or something.

I do understand that some people have experienced time-outs when trying to load a lot of users using the API. If it is not a one-time import I would reccomend that their program load a user then sleep until the program can pull them up and then load the next user. This may take 4+ times longer, but will that be so bad?



Michael Washington
* ADefWebserver.com
* DNN Module Developer's Guide
* IWEB - DNN Web Services
* Silverlight and DotNetNuke
 
New Post 3/3/2007 9:55 AM
User is offline Vladan Strigo
505 posts
Vladan.Strigo.NET
8th Ranked




Re: Adding many users programmatically. 
Modified By Vladan Strigo  on 3/3/2007 1:15:43 PM)

Hmm... the problem is not in using the API, the problem is using the wrong API for completly incorrect purpose - simply because you don't have an appropriate one. And forcing the usage of the same one just because it's there.

If you are loading a 1000 users into the database, from a web application... would you use a method which everytime for each user goes to the database, and adds them one by one? Yes you would (at least you do in source, many times over)... because you have create user API. Instead of thinking... ok this is a bigger batch.... maybe I need to develop a batch insert functionality which inserts for example 100 by 100 users, which can be performant and scalable in the long run?

One good example of this are Portal Templates.... lately I've been digging into the source because of some performance problems... and one example which I was horrified to find is when you are exporting a list of tabs to a template... for each tab the export procedure goes to the database to fetch it's modules, using the API. Now, if you have a small site... ~50 tabs you won't see the problem... but if you have a bigger site ~1000 pages... you will probably feel the pain... let alone other parts of the template. And that's because your using the API. And you could have written a query which in one pass gets all that info and only goes once to the database... but of course you would not use the API. And usually portal templates and such tools prove their worthness with bigger transfers and bigger loads, when it doesn't pay of to do it manually but instead have a tool which can automate the daunting task.

To conclude... I don't have anything against using dnn API, but to push it to users and to say and use it for every purpose, just to prevent the changes from occuring is just plain wrong in my opinion.


Thanks,
Vladan Strigo
NETMedia

My website: Vladan.Strigo.NET

Vladan.Strigo.NET: Projects
* Advanced VS2005 development approach - BlankModule
* DNN & Microsoft Ajax best practices guidance

Vladan.Strigo.NET: Resources
* Comprehensive list of DNN 4 Module development resources

 
Previous Previous
 
Next Next
  Forum  General DotNetN...  Extend It! ( Pr...  Adding many users programmatically.
 


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, please observe the following posting guidelines:

1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

 


Customer Connect
Customer Connect provides cutting edge solutions that deliver sales, marketing and customer service results.
www.customer-connect.com
TechNexxus
Business process and technology sourcing solutions delivering superior people, process and value. We have used, and continue to use, DNN successfully in numerous client projects to deliver exceptional value. We are proud to support the DNN team and community.
www.technexxus.com
PartnerPoint | Community of Microsoft Partners
PartnerPoint is one of the largest and most active online communities of Microsoft Partners worlwide with over 8,000 members.
www.PartnerPoint.com

DotNetNuke Corporation   Terms Of Use  Privacy Statement
DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation
Hosted by MaximumASP