Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Adding many users programmatically.Adding many users programmatically.
Previous
 
Next
New Post
3/1/2007 11:56 PM
 

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 10:33 PM
 

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 7:05 AM
 

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 12:29 PM
 

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
http://ADefWebserver.com
www.ADefHelpDesk.com
A Free Open Source DotNetNuke Help Desk Module
 
New Post
3/3/2007 12:55 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
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Adding many users programmatically.Adding many users programmatically.


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, 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 DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out