CSLA .NET

From Rockford Lhotka's Expert C# 2008 and VB 2008 Business Objects books

Welcome to CSLA .NET Sign in | Join | Help
in Search

Coding Business Objects with CSLA 3.6 and LINQ to SQL- but no data in grid

Last post 01-02-2009, 5:19 PM by Lyndon. 5 replies.
Sort Posts: Previous Next
  •  12-27-2008, 12:04 AM 29375

    Coding Business Objects with CSLA 3.6 and LINQ to SQL- but no data in grid

    Hi,

    I have coded my business objects ( a list class, a single entity class and the info class , along with code for a web based front end and the structure to represent a DAL and a Library, to reflect the examples in the book Expert C# 2008 Business Objects. However, while everything compiles correctly, no data is returned to the grid i have created.

    I am utilizing Windows Authentication, making sure that the web site disables anonymous access and enables Windows Authentication etc. I have set the appropriate changes in the web.config file.

    I am suspecting that I am missing something small. Any ideas as to what might cause no data to show up? (there is data in the  table in the database   ;-)  )

    I have installed the project tracker application  which points to the projecttracker database on the same sql server as my above application and it works, so I am pretty sure much of the database itself is properly configured on the server.

    I can include my code in a subsequent reply to this post. Was just wondering if this was something really simple that I havent configured?

    Thanks

  •  12-27-2008, 10:49 AM 29379 in reply to 29375

    • lukky is not online. Last active: 07-04-2009, 6:55 AM lukky
    • Top 50 Contributor
    • Joined on 05-29-2006
    • Sherbrooke, Qc, Canada
    • Posts 85
    • Points 1,415

    Re: Coding Business Objects with CSLA 3.6 and LINQ to SQL- but no data in grid

    Lyndon,

    Does the data make it into the BOs ?



    Luc Morin, T.P.
    http://www.stlm.ca
  •  12-27-2008, 3:52 PM 29380 in reply to 29379

    Re: Coding Business Objects with CSLA 3.6 and LINQ to SQL- but no data in grid

    From what I can see no.

    I did look a little further into my code for the web page and noticed that I hadnt coded in the

    OnSelectObject="PriorityListDataSource_SelectObject" as part of the CSLA datasource. So it wasnt linking up with the code to go get the business object

    I finally fixed that, but now it looks for the database and cannot find the database name, even though its in the app.config, web.config, and the Database.cs code in the DAL library.

    In running a trace, it looks like it isnt authorizing me to do the select. It seems to skip that code and go directly to a deny authorization segment.

    I am assuming then it must be something to do with the security classes.

    In Lhotka's latest book he seeems to imply that if Windows authentication is used that PTPrincipal and PTSecurity arent needed. So I havent included any specialized code ( used for custom authentication) in my solution/projects. I just wanted to get data back initially without imposing any role restrictions. Can all parts of the security model be 'ignored' initially for authorization/authentication if  one is intending to use Windows Integrated Security ? Or are their certain base parts of the security model that must be in place , even if windows autheincation is used?

    web.config file has csla.authentication="Windows" and  authenication mode =Windows and identity impersonate = true.  IIS server has anonymous access disabled, windows authentication enabled and impersonation enabled.

     

    Thanks

  •  12-29-2008, 8:23 PM 29393 in reply to 29380

    Re: Coding Business Objects with CSLA 3.6 and LINQ to SQL- but no data in grid

    Is the database located on the same box as the web server?

    If not, then you have run into the problem of 2 network hops which is difficult to do with Windows security. See p431 of the C# 2008 book. Rocky does not solve the problem for you in this case. You may have to Google this one.

    Try the same solution using custom Principal code and it should work fine across 2 hops.

    Joe

     

  •  12-30-2008, 4:54 PM 29406 in reply to 29393

    Re: Coding Business Objects with CSLA 3.6 and LINQ to SQL- but no data in grid

    Hi Joe,

    Thank you.

    Yes it is on the same box as the web server. At this point I am trying only the simplest of  configurations. ie everything on one machine, and no special security -Windows Authentication only. Whenever I try out new versions of the CSLA framework , my first goal is to just get data to appear on the grid using the new framework.

    I now have it as far as hanging in the dataportal fetch area. The message coming back in the web application is

    DataPortal.Fetch failed (Database name not found in config file (HRSMV20)) in the Dataportal.cs program.

    Modelling after the project tracker application, I have the following code in my Database.cs file

    using System;

    using System.Collections.Generic;

    using System.Linq;

    using System.Text;

    namespace HRSMCSLA3.DAL

    {

    public class Database

    {

    public const string HRSMV20 = "HRSMV20";

    }

    }

    The linq to SQL dbml file name  is HRSMV20

    AND

    my web.config file includes the following along with the app.config files

    <connectionStrings>

    <add name="HRSMCSLA3.DAL.Properties.Settings.HRSMV20ConnectionString" connectionString="Data Source=LYNDON-MAIN\VS2008;Initial Catalog=HRSMV20;Integrated Security=True" providerName="System.Data.SqlClient"/>

    </connectionStrings>

    CSLA Authenication is Windows

    Authentication Mode is Windows

    Impersonate =true

    and

    Anonymous access turned off, Windows Integrated Security is turned on (using IIS 7.0)

     

    My mistake is probably something really simple- but these are the hardest to trackdown   ;-)  :(

  •  01-02-2009, 5:19 PM 29451 in reply to 29406

    Re: Coding Business Objects with CSLA 3.6 and LINQ to SQL- but no data in grid

    Problem resolved.

    Developer error :(

    I had assumed the name in the connect string in the app.config file was supposed to be the same as the web.config.

    It wasnt.

    Lhotka's project tracker example had it correct. I didnt 

    My bad.

    Thanks for everyones help

View as RSS news feed in XML

Please contact Magenic for your .NET consulting
and CSLA .NET mentoring needs.
Please consider making a donation to help support the ongoing development of CSLA .NET.

Make donation through PayPal - it's fast, free and secure!
Why donate?
Powered by Community Server, by Telligent Systems