mayvelous

Me, Myself and Mayvelous

Archive for the ‘Asp.net’ Category

What is O/R Mapper?

O/R Mapper (Object-Relational Mappers) is a programming technique for converting data between incompatible type systems in databases and Object Oriented Programming languages. (# Ref)

What does it do?

The generated code from the O/R Mapper handles all of the steps that you would normally have to code yourself, saving you from having to:

  • Find the database server.
  • Log in and open a connection to the database server.
  • Select the particular database containing the information you want.
  • Find the correct table.
  • Find the correct row.
  • Read all the values for that row.
  • Convert every type of value from its SQL data type into the .NET data type while checking and handling the possibility of a null value.
  • Present those values in a strongly-typed format, so the consumer knows exactly what kind of object to expect (string, integer, array, etc.) and there are no surprises at run-time.
  • Create a container to temporarily hold the values while they are being modified.
  • Retrieve data from another row in a related table.
  • Manage which values have changed and make appropriate INSERT’s, UPDATE’s, and DELETE’s in the appropriate tables in the database to reflect those changes.
  • Close the connection.

What is LLBLGen Pro

LLBLGen Pro is a complete O/R mapper and data-access tier generator for .NET. It generates a data-access tier and business façade/support tier (in C# or VB.NET), using an existing database schema set. The generated .NET code is provided as a Visual Studio.NET project that can be added to a solution or compiled separately. (# Ref + More Info)

LLBLGen Pro Features

Rapid C# Windows DevelopmentA key feature in LLBLGen Pro is dynamically-generated SQL. When retrieving or manipulating data in a database, the SQL script — the code understood by the database — is generated at run-time based off the requested information and dirty flags in each entity’s fields. This enables a generic save entity function on the Data Access Tier to produce different and optimized SQL code each time it is called, optimizing bandwidth usage and database load. (# Ref)

  • LLBLGen Pro will completely auto-generate the data access layer. You do not need to do any hand-coding in this layer
  • LLBLGen Pro will optionally generate a business logic layer shell for you to get started with your business layer. You do not have to understand the intricacies of inheritance and making custom classes to take advantage of business logic classes; in LLBLGen Pro these classes are intuitively organized, powerful, and infinitely extendable.
  • LLBLGen Pro collections and entity objects are bindable, making them extremely easy to add to .NET controls. This can reduce the size of your UI layer.
  • Changing the database application and the data access layer without affecting the business logiv and UI layers is actually possible with LLBLGen Pro. If you migrated your database schema and stored procedures to a new database application, refraned from using any database-specific features and your schema matched exactly, you could actually re-generate your LLBLGen Pro data access layer and not make any other changes to your application.

# Ref: Rapic CSharp Windows Development. pp. 17

LLBLGen Pro Objects

  • Entities: Every “Row” becomes an “Entity”
  • Collections: Every “Table” becomes an “EntityCollection”. Collection classes eliminate the need for DataTable objects and are both strongly typed and bindable.
  • Entity relationships: Build into each entity are all relationships in the DB involving that table. You can either get a single entity or an entity collection depending on the type of relationship.
  • Typed views: Views in the DB can be wrapped as strongly-typed DataTable. Typed views are read-only; new LLBLGen Pro allows you to add a view from the database as an entity as well as a typed view.
  • Typed Lists: Typed lists are the only objects created by LLBLGen Pro that do not correspond one-to-one with DB objects. It’s handy when you need very specific information that does not necessarily correspond to a single table or entity or you only want to grab a subset of information for a given set of table.
  • Storedprocedures caller classes: Storedproc that you select will be wrapped in a layer of code. While the parameters of the stored procedures are strongly-typed, the result set is still an untyped DataSet.

Project Types: SelfServicing Vs. Adapter

There are two types of LLBLGen Pro Projects namely – SelfServicing and Adapter.
# In SelfServicing template group, entity objects are responsible for their own persistence (saving their own changes to DB).
# The entity class itself contains logic to know which fields were updated and where to find the database.
# Lazy Loading is useful cos’ it abstracts the specific DB call from the upper layers of code.
# Adapter template group: uses an object called a DataAccessAdapter to interact with DB
# SelfServicing: bundles persistence inside entity objects
# Allows data to load itself automoatically as it is needed without explicit commands.

  • Comments Off
  • Filed under: .Net, Asp.net, Development, Notes, Software, Technology, Tools, VS.Net, Web, Work
  • Study Notes

    I’m learning new things these days and am just sharing some notes here. I’m still learning and these technologies are very new for me, hence my notes gonna have heaps of errors and wrong information. You are most welcome to correct them, fill some more in and share you notes with me too. Alright, so we are set to go.

    I’ll be updating this post with links so still tune.

    All the notes are subject to change as I’ll be filling in with more info later.

    Dashes in Rad Files

    This is one of the most frustrating errors I’ve got to fix. I’m using rad editor for my aspx pages and in some pages, it works like a charm but some just doesn’t. Whenever I tried to update the page, it threw this error, “An error has occurred. Refresh the screen and try again”, in the rad editor content area.

    My first thought was, the files much be read-only and hence to make writable to the files but it wasn’t the case. So I checked my code, cross check with another working page, recheck again and again, but I found no difference in code and doesn’t work. Then I created a new “test.aspx” file and pasted the same code and tested it. Strange enough, it works!

    So I thought may be my page got corrupted, so I deleted that page and recreated a new page with the same name, paste the code back in. Then it’s not working again. The same god damn code in “test.aspx” is working and not in the other page.

    Something was really fishily wrong! Since they are the exact same code, the only difference I can think of now is the file name. But I can’t change all the file names without knowing whether that’s the actual cause of the problem. So my final option, turn to google for help and there it was!

    (ID#250) “An error has ocurred. Refresh the screen and try again”

    PROBLEM
    When saving the content from r.a.d.editor directly in the ASPX/ASCX the following error appears:
    An error has ocurred. Refresh the screen and try again.

    SOLUTION
    When saving the r.a.d.editor content directly in the ASPX/ASCX the page name should not contain “(“, “)”, “-”, or ” ‘ “. If such names are obligatory, r.a.d.editor’s content should be saved in a database.

    Link: Telerik KB Article

    So stupid error. My error files are named using the “-” dash. Once I removed the dash, all working. It’s just so lame error message and even in the KB no explanation about why it cannot use a dash in the file names. Well you can use dash if you saving content in DB, but why not in the actual file? I just not satisfy with that KB solution explanation. Nevertheless, it solved my problem and thank god for that. Took hell lotta time from me. I guess next time, I better google first then check on my code. Hmm.

    Unable to find script library

    Whenever you get this kind of error messages with instructions, do not follow the instruction straight away.
    Always turn to your best friend, google, to see how others solve it and search for the best possible answer.
    May be this is a bad advice but I never trust error message instructions. Of course you must read the message and instruction properly to see it is a sensible/reasonable instruction on the problem. As for me, I just have to find out whether others are actually following the instructions as mentioned or not.

    asp_netclient error

    The error:
    Unable to find script library ‘/aspnet_client/system_web/1_1_4322/WebUIValidation.js’. Try placing this file manually, or reinstall by running ‘aspnet_regiis -c’.

    The error dialog box pops up on those pages with form validation.
    This problem happens whenever the system cannot access aspnet_client folder either you don’t have a permission or it is not in your root directory, ie. when you changed the root directory for your virtual folders, from Inetpub/wwwroot to some other folder, and when you use Validation controls (eg. RequiredFieldValidator, ValidationSummary, etc) on input TextBoxes in one of your site.

    You can check whether you are using the default root or not by checking the property > Home Directory of your IIS virtual directory as shown on the following images.

    Default virtual root
    default root

    Custom virtual root
    custom root

    For this error, I don’t like uninstalling IIS and reinstall again just for the sake of one site error. There got to have some easier way to solve it and yes, there is.
    I’ve also found out that when you follow the error instructions straight away, you might screw up the problem more and some of the google results shows that it actually got screwed in some cases.
    Some people uninstalled and reinstalled IIS but that doesn’t solve the problem and they have to uninstalled and reinstalled .net framework as well.
    Different solution for different cases I’m sure, but for my case, I tried the easiest resolution ie. copy the aspnet_client folder from wwwroot to my new virtual root folder, and voila it works!

    Read more in the following sources:

  • Comments Off
  • Filed under: Asp.net, Bugs and Fixes, Development, Project Notes, Work
  • By default, once you create web applications/services, the project files are saved in Inetpub > wwwroot directory.

    To move from default location to your own project directory you must:

    1. first, set up the folder in required directory,
    2. Create Virtuary Directory using IIS to point to your folder,
    3. Using VS.net create new web application with the same virtuary directory name you created in Step 2.

    The new project now will be saved in the folder you speficied rather than in default wwwroot folder. This makes it alot easier to manage your project files and better work folder organization.

    Flickr Photos

    • 11/02/2012
      11/02/2012
      11/02/2012
      11/02/2012
      11/02/2012
      11/02/2012

    Downloads

    Twitter Status


    Goodie Links


    Mayvelous Friends


    GraphicRiver
    1and1 Hosting
    AdBrite
    FlashDen
    In-Links

    I'm an Author for Global Voices

    Archives