Using ORM's

I guess im kinda lazy when it comes to web development - id rather have a design ready made, instead of creating my own, and I would rather have my objects and SQL code all created for me, as opposed to repeatedly writing sql queries and populating records. Thats why I use an ORM - specifically, NetTiers.

Instead of writing:

INSERT INTO Category (ParentCollectionID, CategoryID, CategoryName, CategoryDescription) VALUES (@ParentCollectionID, @CategoryID, @CategoryNAme, @CategoryDescription)

then going ahead to populate all of thise fields, and fill them out, I can just simply write:

            Category category = new Category();

 

            category.ParentCollectionID = parentCollection.CategoryID;

            category.CategoryID = Guid.NewGuid();

            category.CategoryName = txtNewName.Text;

            category.CategoryDescription = txtNewDesc.Text;

 

            DataRepository.CategoryProvider.Insert(category);

And hey presto! That new record has been inserted into the database, and works perfectly. I didnt have to write a thing, I just pointed the ORM at my database.

Leave a comment

Please be polite and on topic. Your e-mail will never be published.

Please add 7 and 2 and type the answer here: