Insert Customer details into the Database, Bussiness Logic

Topics: General Discussion Forum, July and December Releases Forum
Feb 25, 2008 at 7:05 AM
Any body please help me....
I would like to put the customer details into the DB. So i created SC,DC,MC and Translator class.
I created a class in the BussinessLogic named "InsertCustomerAction", with which i am calling this class from my adapter class(Customer Adapter).

What should i write in this InsertCustomerAction Class ?
How can i write codes for Inserting these Values ?
Can anybody please tell me the steps with which i have to follow....

Feb 25, 2008 at 1:07 PM
You can find some help trying the repository factory tool or downloading the WSSFv2 and checking the Reference implementation for ASMX or WCF where it show how to build the Business Logic classes algong with Data Access layer as well.
Feb 26, 2008 at 3:30 AM
Hi CF,
I am using WSSF DEC-2006 Release, So in that there is Data Guidance Pacakage Right, So i dint have to download it na..

Feb 26, 2008 at 8:18 AM
You are right Nimesh. Just go and check the RIs to get an idea of how to implement the BL and DAL.
Feb 26, 2008 at 10:24 AM
Edited Feb 26, 2008 at 10:27 AM
Yeah , i had gone through that. but i am full with some sorts of doubts.
let me tell my doubts :
1). From the Service Implementation class we are calling the Adapter Class, from there Calling the Class in BL which Performs the InsertFunction, inside that.. we have to call the repository class...

CustomerRepository Repo = new CustomerRepository(databasename);

but here return type of Add in the Repository class is void.
I want some response back after the customer details has been sucessfully added, like if it is sucess it must give sucess, else if it exists it must show correspondign messages, How can it made possible ?

2). While Creating the Translator Class using the Receipe, when mapping the DC and BE, in the BE Properties, its showing
Nullable `1 aganist the 2 prpoerties...

Why is it comming so ? if i am Creating the class with that exception, inside the class it will show like :

// Unable to assign a nullable type to a non nullable type.
// to.Active = from.ActiveBE;-------------------------------------------------------> first Property
to.CustomerID = from.CustomerIDBE;-------------------------------------------------------> Second Property
to.CustomerName = from.CustomerNameBE;-------------------------------------------------------> Third Property
// Unable to assign a nullable type to a non nullable type.
// to.CreatedDate = from.CreatedDateBE;-------------------------------------------------------> Fourth Property

3). Every where the request/response type must be the Message Contract or Something else ?

so now i am toatlly confused with some things.... I would like to get clarifications for this,
Hope you can help me.......
Feb 27, 2008 at 12:36 PM
1) Instead of returning a raw boolean a good practice here is to have a one way operation (void return) and throw and exception in case of any error (handled or not). Then act accordingly in the client.
2) Right, you should have both types as Nullables (or both as not nullables). You can set a nullable type in yout DC by setting the IsNullable property of your type element to true.
3) You should always use the Message Contract as the wrapper for a Request/Response pattern. In WCF you have an option "IsWrapped" where your message at the wire level will go wrapped or not. Then the client proxy may be generated by passing only the parameters of the MC instead of creating an instance of the MC and loding its properties.
Feb 28, 2008 at 5:25 AM
Edited Feb 28, 2008 at 5:37 AM
So instead of giving the Message Contract we can give the wrapper name.

Here goes another one doubt....

1 . supose i wanna take some details, let it be the details of the customer.By providign the customer id, i have to fetch all the details corresponding customer for the database.
i have created proxy class, and i am calling it from the client part.

like :

CustomerClient proxy = new CustomerClient();
int txt = Convert.ToInt32( TextBox1.Text);

i hope this dosen't works.

if i want all the details, like name,age,sex and id to be displayed in the listbox, How i have to code for the same.
i want to call it from the client side. .. i am passing parameter like txt to the proxy class, but how can i get the response.....back

Please help me regardign this issue.


Feb 28, 2008 at 8:58 AM
Similar post in thread