Click here to Skip to main content
15,893,161 members
Articles / Programming Languages / XML

netTierGenerator

Rate me:
Please Sign up or sign in to vote.
4.81/5 (20 votes)
30 Nov 2008CPOL14 min read 67.6K   2.8K   108  
A 3-tier application framework and code generation tool - the way for rapid and effective development.
<TierModel Namespace="Administration" ServiceName="User">
    <Declare Type="Kredit.Common.Administration.GenderEnum" />

    <!--<Include Path="Administration\Role.xml" Type="RoleInfo" />-->

    <ItemModel DbTable="tblAdministration_User" ClassName="UserInfo" Parent="">
        <Comment />
        <KeyProperty NeedToGenerate="true" ReadOnly="False">
            <Comment />
            <CSharp CSharpName="id" CSharpType="Guid" />
            <Db DbName="rowguid" DbType="uniqueidentifier" IsNullable="False" Length="16" />
        </KeyProperty>
        <Property>
            <Comment />
            <CSharp CSharpName="Cost" CSharpType="decimal" />
            <Db DbName="Cost" DbType="numeric" IsNullable="False" Length="9" />
        </Property>        
        <Property ReadOnly="False">
            <Comment />
            <CSharp CSharpName="CountryID" CSharpType="Guid" />
            <Db DbName="CountryID" DbType="uniqueidentifier" IsNullable="True" Length="16" />
        </Property>
        <Property ReadOnly="False">
            <Comment />
            <CSharp CSharpName="UID" CSharpType="string" Length="10" />
            <Db DbName="UID" DbType="nchar" IsNullable="False" Length="10" />
        </Property>
        <Property ReadOnly="False">
            <Comment />
            <CSharp CSharpName="Login" CSharpType="string" Length="50" />
            <Db DbName="Login" DbType="nvarchar" IsNullable="False" Length="50" />
        </Property>
        <Property ReadOnly="False">
            <Comment />
            <CSharp CSharpName="Password" CSharpType="string" Length="100" />
            <Db DbName="Password" DbType="nvarchar" IsNullable="True" Length="100" />
        </Property>
        <Property ReadOnly="False">
            <Comment />
            <CSharp CSharpName="CreatedDate" CSharpType="DateTime" />
            <Db DbName="CreatedDate" DbType="datetime" IsNullable="False" Length="8" />
        </Property>
        <Property ReadOnly="False">
            <Comment />
            <CSharp CSharpName="FirstName" CSharpType="string" Length="50" />
            <Db DbName="FirstName" DbType="nvarchar" IsNullable="True" Length="50" />
        </Property>
        <Property ReadOnly="False">
            <Comment />
            <CSharp CSharpName="MiddleName" CSharpType="string" Length="50" />
            <Db DbName="MiddleName" DbType="nvarchar" IsNullable="True" Length="50" />
        </Property>
        <Property ReadOnly="False">
            <Comment />
            <CSharp CSharpName="LastName" CSharpType="string" Length="50" />
            <Db DbName="LastName" DbType="nvarchar" IsNullable="True" Length="50" />
        </Property>
        <Property ReadOnly="False">
            <Comment />
            <CSharp CSharpName="Email" CSharpType="string" Length="50" />
            <Db DbName="Email" DbType="nvarchar" IsNullable="True" Length="50" />
        </Property>
        <Property ReadOnly="False">
            <Comment />
            <CSharp CSharpName="HomePhone" CSharpType="string" Length="20" />
            <Db DbName="HomePhone" DbType="nvarchar" IsNullable="True" Length="20" />
        </Property>
        <Property ReadOnly="False">
            <Comment />
            <CSharp CSharpName="CellPhone" CSharpType="string" Length="20" />
            <Db DbName="CellPhone" DbType="nvarchar" IsNullable="True" Length="20" />
        </Property>
        <Property ReadOnly="False">
            <Comment />
            <CSharp CSharpName="Culture" CSharpType="string" Length="5" />
            <Db DbName="Culture" DbType="nchar" IsNullable="True" Length="5" />
        </Property>
        <Property ReadOnly="False">
            <Comment />
            <CSharp CSharpName="IsAnonymous" CSharpType="bool" />
            <Db DbName="IsAnonymous" DbType="bit" IsNullable="True" Length="1" />
        </Property>
        <Property ReadOnly="False">
            <Comment />
            <CSharp CSharpName="IsLockedOut" CSharpType="bool" />
            <Db DbName="IsLockedOut" DbType="bit" IsNullable="True" Length="1" />
        </Property>
        <Property ReadOnly="False">
            <Comment />
            <CSharp CSharpName="BirthDate" CSharpType="DateTime" />
            <Db DbName="BirthDate" DbType="datetime" IsNullable="True" Length="8" />
        </Property>
        <Property ReadOnly="False">
            <Comment />
            <CSharp CSharpName="Gender" CSharpType="GenderEnum" />
            <Db DbName="Gender" DbType="tinyint" IsNullable="False" Length="1" />
        </Property>
        <Property ReadOnly="False">
            <Comment />
            <CSharp CSharpName="Theme" CSharpType="string" Length="50" />
            <Db DbName="Theme" DbType="nvarchar" IsNullable="True" Length="50" />
        </Property>
        <Property ReadOnly="False">
            <Comment />
            <CSharp CSharpName="LastLogin" CSharpType="DateTime" />
            <Db DbName="LastLogin" DbType="datetime" IsNullable="True" Length="8" />
        </Property>
        <Property ReadOnly="False">
            <Comment />
            <CSharp CSharpName="Comment" CSharpType="string" Length="max" />
            <Db DbName="Comment" DbType="nvarchar" IsNullable="True" Length="max" />
        </Property>
        <SelectMethod NeedToCreate="True" DalAccess="True" BllAccess="True" />
        <InsertMethod NeedToCreate="True" DalAccess="True" BllAccess="True" />
        <UpdateMethod NeedToCreate="True" DalAccess="True" BllAccess="True" />
        <DeleteMethod NeedToCreate="True" DalAccess="True" BllAccess="True" />
    </ItemModel>
    <ItemModel DbTable="tblAdministration_UserRole" ClassName="UserRoleInfo" Parent="">
        <Comment />
        <KeyProperty>
            <Comment />
            <CSharp CSharpName="UserId" CSharpType="Guid" />
            <Db DbName="UserId" DbType="uniqueidentifier" IsNullable="False" Length="16" />
        </KeyProperty>
        <Property>
            <Comment />
            <CSharp CSharpName="RoleId" CSharpType="Guid" />
            <Db DbName="RoleId" DbType="uniqueidentifier" IsNullable="False" Length="16" />
        </Property>
        <SelectMethod NeedToCreate="False" />
        <InsertMethod NeedToCreate="False" />
        <UpdateMethod NeedToCreate="False" />
        <DeleteMethod NeedToCreate="False" />
    </ItemModel>

    <ListItemModel DbView="vwAdministration_User" ClassName="UserListItem" Parent="">
        <Comment />
        <KeyProperty>
            <Comment />
            <CSharp CSharpName="id" CSharpType="Guid" />
            <Db DbName="rowguid" DbType="uniqueidentifier" IsNullable="False" Length="16" />
        </KeyProperty>
        <Property>
            <Comment />
            <CSharp CSharpName="UID" CSharpType="string" Length="10" />
            <Db DbName="UID" DbType="nchar" IsNullable="False" Length="10" />
        </Property>
        <Property>
            <Comment />
            <CSharp CSharpName="Login" CSharpType="string" Length="50" />
            <Db DbName="Login" DbType="nvarchar" IsNullable="False" Length="50" />
        </Property>
        <Property>
            <Comment />
            <CSharp CSharpName="Password" CSharpType="string" Length="100" />
            <Db DbName="Password" DbType="nvarchar" IsNullable="True" Length="100" />
        </Property>
        <Property>
            <Comment />
            <CSharp CSharpName="CreatedDate" CSharpType="DateTime" />
            <Db DbName="CreatedDate" DbType="datetime" IsNullable="False" Length="8" />
        </Property>
        <Property>
            <Comment />
            <CSharp CSharpName="FirstName" CSharpType="string" Length="50" />
            <Db DbName="FirstName" DbType="nvarchar" IsNullable="True" Length="50" />
        </Property>
        <Property>
            <Comment />
            <CSharp CSharpName="MiddleName" CSharpType="string" Length="50" />
            <Db DbName="MiddleName" DbType="nvarchar" IsNullable="True" Length="50" />
        </Property>
        <Property>
            <Comment />
            <CSharp CSharpName="LastName" CSharpType="string" Length="50" />
            <Db DbName="LastName" DbType="nvarchar" IsNullable="True" Length="50" />
        </Property>
        <Property>
            <Comment />
            <CSharp CSharpName="Email" CSharpType="string" Length="50" />
            <Db DbName="Email" DbType="nvarchar" IsNullable="True" Length="50" />
        </Property>
        <Property>
            <Comment />
            <CSharp CSharpName="HomePhone" CSharpType="string" Length="20" />
            <Db DbName="HomePhone" DbType="nvarchar" IsNullable="True" Length="20" />
        </Property>
        <Property>
            <Comment />
            <CSharp CSharpName="CellPhone" CSharpType="string" Length="20" />
            <Db DbName="CellPhone" DbType="nvarchar" IsNullable="True" Length="20" />
        </Property>
        <Property>
            <Comment />
            <CSharp CSharpName="Culture" CSharpType="string" Length="5" />
            <Db DbName="Culture" DbType="nchar" IsNullable="True" Length="5" />
        </Property>
        <Property>
            <Comment />
            <CSharp CSharpName="IsAnonymous" CSharpType="bool" />
            <Db DbName="IsAnonymous" DbType="bit" IsNullable="True" Length="1" />
        </Property>
        <Property>
            <Comment />
            <CSharp CSharpName="IsLockedOut" CSharpType="bool" />
            <Db DbName="IsLockedOut" DbType="bit" IsNullable="True" Length="1" />
        </Property>
        <Property>
            <Comment />
            <CSharp CSharpName="BirthDate" CSharpType="DateTime" />
            <Db DbName="BirthDate" DbType="datetime" IsNullable="True" Length="8" />
        </Property>
        <Property>
            <Comment />
            <CSharp CSharpName="Gender" CSharpType="GenderEnum" />
            <Db DbName="Gender" DbType="tinyint" IsNullable="False" Length="1" />
        </Property>
        <Property>
            <Comment />
            <CSharp CSharpName="Theme" CSharpType="string" Length="50" />
            <Db DbName="Theme" DbType="nvarchar" IsNullable="True" Length="50" />
        </Property>
        <Property>
            <Comment />
            <CSharp CSharpName="LastLogin" CSharpType="DateTime" />
            <Db DbName="LastLogin" DbType="datetime" IsNullable="True" Length="8" />
        </Property>
        <Property>
            <Comment />
            <CSharp CSharpName="Comment" CSharpType="string" Length="100" />
            <Db DbName="Comment" DbType="nvarchar" IsNullable="True" Length="100" />
        </Property>
    </ListItemModel>

    <SelectMethod Name="GetUserByLogin">
        <Comment />
        <Property>
            <Comment />
            <CSharp CSharpName="Login" CSharpType="string" Length="20" />
            <Db DbName="Login" DbType="nvarchar" IsNullable="False" Length="20" />
        </Property>
        <Return ReturnType="UserInfo">
            <Comment />
        </Return>
        <Sql>
            <Query><![CDATA[SELECT * FROM tblAdministration_User WHERE Login = @Login]]></Query>
        </Sql>
    </SelectMethod>
    <SelectMethod Name="IsLoginUsed">
        <Comment />
        <Property ReadOnly="False">
            <Comment />
            <CSharp CSharpName="Login" CSharpType="string" Length="30" />
            <Db DbName="Login" DbType="nvarchar" IsNullable="False" Length="30" />
        </Property>
        <Property>
            <Comment />
            <CSharp CSharpName="UserId" CSharpType="Guid" />
            <Db DbName="UserId" DbType="uniqueidentifier" IsNullable="False" Length="16" />
        </Property>
        <Return ReturnType="bool">
            <Comment />
        </Return>
        <Sql>
            <Query>
                <![CDATA[
IF EXISTS(SELECT 1 * FROM tblAdministration_User WHERE (Login = @Login) AND (Rowguid <> @UserId OR @UserId IS NULL)) 
BEGIN
    SELECT CAST(1 AS BIT)
END
ELSE
BEGIN
    SELECT CAST(0 AS BIT)
END]]>
            </Query>
        </Sql>
    </SelectMethod>
    <SelectMethod Name="IsEmailUsed">
        <Comment />
        <Property>
            <Comment />
            <CSharp CSharpName="Email" CSharpType="string" Length="50" />
            <Db DbName="Email" DbType="nvarchar" IsNullable="True" Length="50" />
        </Property>
        <Property>
            <Comment />
            <CSharp CSharpName="UserId" CSharpType="Guid" />
            <Db DbName="UserId" DbType="uniqueidentifier" IsNullable="False" Length="16" />
        </Property>
        <Return ReturnType="bool">
            <Comment />
        </Return>
        <Sql>
            <Query>
                <![CDATA[
IF EXISTS(SELECT 1 * FROM tblAdministration_User WHERE (Email = @Email) AND (Rowguid <> @UserId OR @UserId IS NULL))
BEGIN
    SELECT CAST(1 AS BIT)
END
ELSE
BEGIN
    SELECT CAST(0 AS BIT)
END]]>
            </Query>
        </Sql>
    </SelectMethod>
    <SelectMethod Name="GetUserListPage">
        <Comment />
        <Return ReturnType="ListPage" Type="UserListItem">
            <Comment />
        </Return>
        <Sql>
            <Query><![CDATA[SELECT * FROM vwAdministration_User]]></Query>
        </Sql>
    </SelectMethod>
    <SelectMethod Name="IsUIDUsed">
        <Comment />
        <Return ReturnType="bool">
            <Comment />
        </Return>
        <Property>
            <Comment />
            <CSharp CSharpName="UID" CSharpType="string" Length="10" />
            <Db DbName="UID" DbType="nchar" IsNullable="True" Length="10" />
        </Property>
        <Sql>
            <Query>
                <![CDATA[
IF EXISTS(SELECT 1 * FROM tblAdministration_User WHERE UID = @UID) 
BEGIN
    SELECT CAST(1 AS BIT)
END
ELSE
BEGIN
    SELECT CAST(0 AS BIT)
END]]>
            </Query>
        </Sql>
    </SelectMethod>

    <!--<SelectMethod Name="GetUserRoleListByUserId" DalAccess="True" BllAccess="False">
        <Comment />
        <Return ReturnType="IList" Type="RoleInfo">
            <Comment />
        </Return>
        <Property>
            <Comment />
            <CSharp CSharpName="UserId" CSharpType="Guid" />
            <Db DbName="UserId" DbType="uniqueidentifier" IsNullable="False" Length="16" />
        </Property>
        <Sql>
            <Query>
                <![CDATA[SELECT * FROM vwAdministration_UserRole WHERE UserId = @UserId]]>
            </Query>
        </Sql>
    </SelectMethod>
    <UpdateMethod Name="InsertUserRole" DalAccess="True" BllAccess="False">
        <Comment>Insert User-Role many to many collection item</Comment>
        <Property>
            <Comment />
            <CSharp CSharpName="UserId" CSharpType="Guid" />
            <Db DbName="UserId" DbType="uniqueidentifier" IsNullable="False" Length="16" />
        </Property>
        <Property>
            <Comment />
            <CSharp CSharpName="RoleId" CSharpType="Guid" />
            <Db DbName="RoleId" DbType="uniqueidentifier" IsNullable="False" Length="16" />
        </Property>
        <Sql>
            <Query><![CDATA[INSERT INTO [tblAdministration_UserRole] ([UserId], [RoleId]) VALUES (@UserId, @RoleId)]]></Query>
        </Sql>
    </UpdateMethod>
    <DeleteMethod Name="DeleteUserRole" DalAccess="True" BllAccess="False">
        <Comment>Delete User-Role many to many collection item</Comment>
        <Property>
            <Comment />
            <CSharp CSharpName="UserId" CSharpType="Guid" />
            <Db DbName="UserId" DbType="uniqueidentifier" IsNullable="False" Length="16" />
        </Property>
        <Property>
            <Comment />
            <CSharp CSharpName="RoleId" CSharpType="Guid" />
            <Db DbName="RoleId" DbType="uniqueidentifier" IsNullable="False" Length="16" />
        </Property>
        <Sql>
            <Query><![CDATA[DELETE FROM tblAdministration_UserRole WHERE UserId = @UserId AND RoleId = @RoleId]]></Query>
        </Sql>
    </DeleteMethod>
    <DeleteMethod Name="DeleteUserRoles" DalAccess="True" BllAccess="False">
        <Comment>Delete all User-Role many to many collection items</Comment>
        <Property>
            <Comment />
            <CSharp CSharpName="UserId" CSharpType="Guid" />
            <Db DbName="UserId" DbType="uniqueidentifier" IsNullable="False" Length="16" />
        </Property>
        <Sql>
            <Query><![CDATA[DELETE FROM tblAdministration_UserRole WHERE UserId = @UserId]]></Query>
        </Sql>
    </DeleteMethod>-->

</TierModel>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions