CSLA .NET Contrib News Feed 
Wednesday, April 9, 2014  |  From CSLA .NET Contrib

When my private backing field SetProperty is called...even though it is ByRef, the value in mDTO.EvidNum does not change until AFTER the PropertyHasChanged runs.


This means that a simple rule like StringRequired runs and sees an empty string and the rule stays broken.  But the next step after rules running is that the mDTO.EvidNum property setter is called.  So you look at the business object and the rule is broken but there is a value there.


Any ideas?  I assume the CSLA code assumes a private backing field is just a string not a Class.StringProperty.


 


I have the following code:


    Private Shared EvidNumPropertyInfo As PropertyInfo(Of String) = RegisterProperty(Of String)(Function(c) c.EvidNum, RelationshipTypes.PrivateField)


    Public Property EvidNum() As String


        Get


            Return GetProperty(EvidNumPropertyInfo, mDTO.EvidNum)


        End
Get


        Set(ByVal value As String)


            SetProperty(EvidNumPropertyInfo,
mDTO.EvidNum, value)


        End
Set













Normal
0




false
false
false

EN-US
JA
X-NONE






















































































































































































    End
Property


 

Monday, April 7, 2014  |  From CSLA .NET Contrib

I am not sure if I posted this question before or somebody posted it, but somehow I cannot find the discussion.


We had lots of in-house applications that uses CSLA 3.0.6, .NET Framework 3.5/4, VS2010.  Would it possible to upgrade all of those to the latest CSLA version (4.5.501), .NET Framework 4.5 and VS 2012?


One our concern are there lots of validation and business rules in any of the project.


Thanks.

Monday, April 7, 2014  |  From CSLA .NET Contrib

So CSLA with iOS is in "beta" or in the initial stages of becoming possible - I do believe by looking at a pamphlet from Xamarin that they also drive Mac OS native applications.  I have a question out to someone at Xamarin as to whether these would be two different projects and native app buildouts in the solution (I'm guessing they would be).


In thinking about advocating for the Xamarin approach here, I wanted to see what the envisioned CSLA support for Mac OS would be.  Is that basically done when iOS became potentially supported or is this another ball of wax?

Thursday, April 3, 2014  |  From CSLA .NET Contrib

Hello everyone,


I have developed wcf .net 4 REST service that uses the wcf dataportal. Both services
are hosted in IIS 7 in same web app.  Parts of the web.config are enclosed at the end of this message.  


My wcf service runs successfully on ASP.NET developer server, but not in the IIS web server.  When accessing an API from web browser on port 80, I keep receiving this exception message:


Exception has been thrown by the target of an invocation


Would you have any ideas why could this be happening?  


 


The web,config:


<?xml version="1.0"?>


<configuration>


  <appSettings>


    <add key="MyDbName" value="MY_DB" />


    <add key="CslaAuthentication" value="Csla"/>


  </appSettings>


  <connectionStrings/>


  <system.serviceModel>


    <protocolMapping>


      <add scheme="http" binding="webHttpBinding" />


    </protocolMapping>


    <behaviors>


      <serviceBehaviors>


        <behavior name="WebServiceBehavior">


          <serviceMetadata httpGetEnabled="true"/>


          <serviceDebug includeExceptionDetailInFaults="true"/>


        </behavior>


        <behavior name="returnFaults">


          <serviceDebug includeExceptionDetailInFaults="true" />


        </behavior>


      </serviceBehaviors>


      <endpointBehaviors>


        <behavior name="RESTEndpointBehavior">


          <webHttp />


        </behavior>


      </endpointBehaviors>


    </behaviors>


    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" minFreeMemoryPercentageToActivateService="1" />


    <services>


      <service behaviorConfiguration="WebServiceBehavior" name="Something">


        <endpoint address="" binding="webHttpBinding" contract="ISomethingContract" behaviorConfiguration="RESTEndpointBehavior" />


        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>


        <host>


          <baseAddresses>


            <add baseAddress="http://localhost:8000" />


          </baseAddresses>


        </host>


      </service>


      <service name="Csla.Server.Hosts.WcfPortal" behaviorConfiguration="returnFaults">


        <endpoint binding="wsHttpBinding" contract="Csla.Server.Hosts.IWcfPortal" bindingConfiguration="WSHttpBinding_IWebService"/>


      </service>


    </services>


    <bindings>


      <wsHttpBinding>


        <binding name="WSHttpBinding_IWebService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">


          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>


          <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/>


          <security mode="None">


            <transport clientCredentialType="None"/>


          </security>


        </binding>


      </wsHttpBinding>


    </bindings>    


  </system.serviceModel>


  <system.web>


    <sessionState mode="InProc" cookieless="true" regenerateExpiredSessionId="false" timeout="20"/>


    <compilation debug="true" targetFramework="4.0">


    </compilation>


    <authentication mode="Windows"/>


       <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>


  </system.web> 



</configuration>



 


Thank you in advance,
Tanja


PS. The web site is setup in the ASP.NET v4.0 Application pool  (Integrated managed pipeline mode and ApplicationPoolIdentity for indenty) and the WcfPortal.svc is located in the same location where my svc file is.

Friday, March 28, 2014  |  From CSLA .NET Contrib

Hi,


 


I am new to CSLA. And got stuck up.


 


i am getting the following error when using the Entity frameework.


 


Error 1 The type 'ShasPatho.DalEf.ShasPathoEntities' cannot be used as type parameter 'C' in the generic type or method 'Csla.Data.ObjectContextManager<C>'. There is no implicit reference conversion from 'ShasPatho.DalEf.ShasPathoEntities' to 'System.Data.Objects.ObjectContext'.


 


any help would be great.


 


regards


 


ashish


Wednesday, March 26, 2014  |  From CSLA .NET Contrib

Microsoft is interested in buying Xamarian.  More MVVM frameworks are now working better with PCL and multi platform solutions such as MVVMCROSS.  With these changes in the multi platform arena, has there been any readdressing of the issue of building a CSLA Core module compatible with Portable Class Libraries?  I am now having to face the decision of leaving behind my beloved CSLA.

Tuesday, March 25, 2014  |  From CSLA .NET Contrib

I have a created a Read Only Lists that inherits from CSLA ReadOnlyListBase. I am calling a BeginGet method passing in a criteria class (both classes have been marked as serializable).


This fetch does work on the first call, however any subsequent calls of the same method are causing the error below:


ERROR MESSAGE:


{: at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result) at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result) at System.ServiceModel.ClientBase1.ChannelBase1.EndInvoke(String methodName, Object[] args, IAsyncResult result) at Csla.WcfPortal.WcfPortalClient.WcfPortalClientChannel.EndFetch(IAsyncResult result) at Csla.WcfPortal.WcfPortalClient.Csla.WcfPortal.IWcfPortal.EndFetch(IAsyncResult result) at Csla.WcfPortal.WcfPortalClient.OnEndFetch(IAsyncResult result) at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result) : Error HRESULT E_FAIL has been returned from a call to a COM component. at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult) at System.Net.Browser.BrowserHttpWebRequest.<>c_DisplayClassa.b_9(Object sendState) at System.Net.Browser.AsyncHelper.<>c_DisplayClass4.b_0(Object sendState) }


My breakpoint on the DataPortal_Fetch method is not being hit (after the first fetch) on the server side, as the error indicates. 


Any advice to help me solve this would be appreciated.

Friday, March 21, 2014  |  From CSLA .NET Contrib

Hi guys,


I think I have an interesting one.  I have been reading many, many discussions on this topic and altering my code and have found an interesting quirk.  Below are the most useful discussions I've read and taken ideas from.


http://forums.lhotka.net/forums/p/12036/56156.aspx


http://forums.lhotka.net/forums/p/8931/42494.aspx


I have a .NET 4.5, CSLA 4.5.40, Silverlight 5, IIS 7.5 application that has been working terrifically locally but I've been trying to deploy to a webserver.  My AppPool settings have gone through every possible permutation but I have settled with Integrated and Identity: LocalSystem.  If I change the identity it gives similar results as mentioned below but with a different system account.  IIS site authentication only has ASP .NET Impersonation and Windows Authentication Enabled.


Here is the web.config with all the tags that have been identified as required:


<?xml version="1.0" encoding="utf-8"?>


<configuration>


  <appSettings>


    <add key="EventLogName" value="GreyDev" />


    <add key="CslaAuthentication" value="Windows"/>


    <add key="CslaWriter" value="Csla.Serialization.Mobile.CslaBinaryWriter, Csla" />


    <add key="CslaReader" value="Csla.Serialization.Mobile.CslaBinaryReader, Csla" />


  </appSettings>


  <connectionStrings>


PRIVATE :)


  </connectionStrings>


  <system.web>


    <compilation debug="true" targetFramework="4.5" />


    <authentication mode="Windows" />


    <identity impersonate="true" />


    <pages controlRenderingCompatibilityVersion="4.0"/>


  </system.web>


  <system.webServer>


    <validation validateIntegratedModeConfiguration="false" />


  </system.webServer>


  <system.serviceModel>


    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" />


    <services>


      <service behaviorConfiguration="WcfPortalBehavior" name="Business.Compression.CompressedHost">


        <endpoint binding="basicHttpBinding" contract="Csla.Server.Hosts.Mobile.IWcfPortal" bindingConfiguration="BasicHttpBinding_IWcfPortal" />


      </service>


    </services>


    <behaviors>


      <serviceBehaviors>


        <behavior name="WcfPortalBehavior">


          <serviceDebug includeExceptionDetailInFaults="true" />


 <serviceAuthorization impersonateCallerForAllOperations="true" />


        </behavior>


      </serviceBehaviors>


    </behaviors>


    <bindings>


      <basicHttpBinding>


        <binding name="BasicHttpBinding_IWcfPortal" 


maxReceivedMessageSize="2147483647"


                   maxBufferPoolSize="2147483647"


                   maxBufferSize="2147483647" >


          <readerQuotas maxBytesPerRead="2147483647"


                          maxArrayLength="2147483647"


                          maxStringContentLength="2147483647"


                          maxNameTableCharCount="2147483647"


                          maxDepth="2147483647" />


          <security mode="TransportCredentialOnly">


            <transport clientCredentialType="Windows" />


          </security>


        </binding>


      </basicHttpBinding>


    </bindings>


  </system.serviceModel>


</configuration>




On to my results.  In my AppIdentity class I call the CSLA method PopulateWindowsIdentity().  Digging into this method I found that the main call to retrieve the impersonated windows user is:  var currentUser = System.Security.Principal.WindowsIdentity.GetCurrent();

No matter what config, IIS or AppPool settings I have changed, the returned WindowsIdentity.Name is always "NT AUTHORITY\SYSTEM" (this varies when changing the AppPool Identity as mentioned before).  It never impersonated the user, in my case 'speters' (my AD name).  I have made a small ASP web app with the same config and IIS settings and in that app, Impersonation works!  In that application, I have found that the web.config setting <identity impersonate="true" /> directly turns off or on the Impersonation with the true/false setting.


After 3 days of trying every setting I could find, reading every article I could find, I decided to call another method in my AppIdentity class, var cslaname = Csla.ApplicationContext.User.Identity.Name.

This Csla.ApplicationContext call successfully retreives my Impersonated AD credentials.  With this information I have managed to check the result of both Identity calls and choose the one that is needed, so technically my applicaton is working.  However, I still would love to know what it takes to get the WindowsIdentity to properly Impersonate.


In Summary, with all the above settings:

System.Security.Principal.WindowsIdentity.GetCurrent().Name; Does NOT Impersonate Client User AD

Csla.ApplicationContext.User.Identity.Name;  Does Impersonate/Fetch Client User AD


Any thoughts on whats happening here?

 

Friday, March 21, 2014  |  From CSLA .NET Contrib

I've noticed that
short-circuiting rules in CSLA 4.5.501.0 is not working. That is when I
set prioritization to my business rules then set the
ProcessThroughPriority. When I query the Broken Rules I get all invalid
rules even those that has higher priority than ProcessThroughPriority
value. Is there a newer way of doing it?

Thursday, March 20, 2014  |  From CSLA .NET Contrib

Hi,


Before upgrading from 4 to 4.5, exceptions coming back from the data portal would have the message of the original exception such as "Another user has modified the row in Table1, update failed".  Now all that comes back as the message is than an Async Error occurred.  There is no detail as to the problem.  What is the method that people are using to return the original message such as a table update failed back to the client?


Todd Haehn

Wednesday, March 19, 2014  |  From CSLA .NET Contrib

I had assumed that SafeDataReader would convert any null strings coming from SQL Server into String.Empty.

But after finding some app exceptions logged, I have confirmed that null values from the database are being set to Nothing (vb.net) in their properties. I don't want to have to deal with null/Nothing in string properties.

Am I doing something wrong?

The code I am using was generated by CodeSmith, using encapsulated implementation. It uses a SafeDataReader, and in this case it passes it to a Map routine.

Something like this:

LoadProperty(_LongDescriptionProperty, reader.Item("LongDescription"))


Will break my app if I try something like:

Foo.LongDescription.Trim, because it will throw an exception.

Am I doing something wrong? I'd hate to have to write a bunch of code to check for null values, and convert them to empty strings.


Thanks.

FWIW, I'm a longtime user of CSLA (since VB6 days). Not on every project, but on quite a few, in different industries. It's a great tool.


 


 

Wednesday, March 19, 2014  |  From CSLA .NET Contrib

Hi there,


Need some clarification on this statement from previous post:


My key issue is that there is a LOT you must make sure to NOT use, such as the standard rules, the CslaContrib rules 
or the CslaGenFork rules.

Refresh of my situation:


  • I am using DTO from my DAL as a private field in BusinessBase object.  The individual PropertyInfo objects are marked with PrivateField and the Getters/Setters use the GetProperty and SetProperty.
  • I cannot bring myself to write a LoadProperty/ReadProperty overload for every property!  It is too unmaintainable unless I only had a couple properties.

Currently I am using the CommonRules and they work great!!  Only the DataAnnotation rules do not work.  I debugged the CommonRule, the execution does a Using ByPassPropertyChecks and then calls my getter on the primary property using the DynamicMethodGetter.


Given the following parameters (question below)


  • I do not use Async rules
  • I do not use the CSLAContrib or CSLAGenFork rules
  • I do not use Input or OutputProperties
  • I do not target async clients (WinRt, WPhone, Silverlight)
  • If I DO ever write an async rule with no Target access OR if I use input/output properties I will do Load/ReadProperty overload for the few relevant properties

Am I missing something?  Thanks for patience as I understand the guts of what is going on. 


This code is screaming fast and I like not having to load my business object properties one by one from the DAL layer at fetch and update!  Yes my DTO is tied into my BusinessLayer, but I am willing to live with that for the benefit.


Extra benefit is I want to spin up a ReadOnly version I can transfer the DTO to a ReadOnly Friend factory method and viola!

Tuesday, March 18, 2014  |  From CSLA .NET Contrib

Hi,


Hopefully this question will have better success than the last....


I have table called GP. 
Two of the fields are called IsCurrentOption and GPPracticeId .


The GPPracticeId is a foreign key to the GPPractice
table.  A GPPractice also has an IsCurrentOption
field.


I have a rule that if the GP record is related to a GPPractice
with the IsCurrentOption  = false then
the GP must have IsCurrentOption = false.


I’ve created a Dynamic Root List based on the GP table.  This has rules in places to deal with the
scenario above and that all works well.


In my list I want to stop the user from being able to edit
the IsCurrentOption field if the associated GPPractice is IsCurrentOption  = false.


I created a custom Authorization rule to deal with that
scenario. 


When the list is loaded the rule is evaluated and the IsCurrentOption
property is readonly where appropriate.


If the GPPractice is changed to a GPPractice that has IsCurrentOption
 = true my Authorization rule is not checked.  Instead the BusinessBase will consult its
cache and get the value from the last time the rule was checked.  It’s not until the BusinessBase is saved (I’m
assuming  putting the BusinessBase  through the data portal loses its cache as the
caches are not serialised), will the rule be checked and return the correct
result.


I couldn’t see any way of forcing my rule to be checked when
the properties are changed.


 


Any idea’s how I can resolve this issue? 


Many thanks,


Nathan

Tuesday, March 18, 2014  |  From CSLA .NET Contrib

I said sometime this week, and Kevin really worked hard on this, so the 4.5.580 pre-release with iOS support (via Xamarin tools) is now on nuget and GitHub:


http://www.lhotka.net/weblog/CSLANETBetaReleaseSupportingIOS.aspx


 

Monday, March 17, 2014  |  From CSLA .NET Contrib

We're closing in on a version of CSLA .NET that works on iOS using the Xamarin tools.


This is the result of a lot of work by Stuart Bale, Kevin Ford, and myself, and Kevin is getting very close to where we can release a beta version - hopefully yet this week.


If you have Xamarin for iOS I hope you'll help us test this out, but we're very excited!!

Sunday, March 16, 2014  |  From CSLA .NET Contrib

Rockford Lhotka says:


"Collections do not support direct declaration of properties, so you can’t implement properties in this class. If properties are required in addition to the list of child objects, you should create an editable parent object that contains the collection, along with those other properties and their rules."


 


So, I decided to check this out.


I've declared simply property in my inherited BusinessBindingListBase. Somethink like this:


property long DocId { get; set; }


 


I can do "Fetch" and "Update". And it works. My custom property always persist.


But I'm working with 2-tier mode.


 


Maybe it will not work in 3-tier? What reasons could stop me from using custom properties in BusinessBindingListBase?

Saturday, March 15, 2014  |  From CSLA .NET Contrib

If I add a private variable on my BusinessListBase...how or can I serialize it so it is still there on the other side of the WCF portal?


Say like this?


TestList BusinessListBase(of Test)


private mTestString as String


I assumed the BusinessListBase would preserve and serialize variable just like BusinessBase but apparently not.


I am tracking a list of issues to report to the parent when IParent is set in SetParent after DataPortal call.  I override SetParent and alert the root parent in there.


Any ideas


Sean

Thursday, March 13, 2014  |  From CSLA .NET Contrib

Hello Everyone,


We have upgraded the CSLA version from "2.1.4" to "3.5.3", after testing the csla new changes in the developer environment we recently pushed our changes to the QA environment and after pushing the changes we started getting few errors. Basically after pushing the changes to QA environment all our projects got build successfully including the upgraded CSLA project but when we try to access our site we are getting the below error:


Error:


"Could not load file or assembly 'csla, version=2.1.4.0, culture=neutral, PublicKeyToken=93be5fdc093e4c30'or one of its dependencies. The located assembly's manifest defination does not match the assembly reference. (Exception from HRESULT: 0x80131040)".


What is the actual cause of this issue? As the CSLA project has been successfully build then why after using this csla.dll refrence in other Libraries we are still getting the above issue? 


Kindly help us to resolve the above mentioned issue, as we did not got any proper solution to fix this issue till now.  


Thanks for your help in advance.

Wednesday, March 12, 2014  |  From CSLA .NET Contrib

Working on a project where there is missing Ref Int on the SQL database.  Business objects have to handle scenario of missing data by IDs.  (ugh I know).


During lazyload of child collection, if I detect there is some piece of data missing from the DB, I skip loading that child.


But I would like to provide feedback (Warning rule) on Parent that alerts user that the BusinessObjects have detected a referential integrity problem and what are the IDs associated with the problem.  This would give the customer some very helpful information to give to their DBA to go fix the issue.


How would I have the child collection tell the root/parent to break a warning rule with relevant info?


How would I write the rule on the root/parent so it only gets broken when the child collection says so.


Seems like broken rules is a good place to put this, maybe I am wrong?



Thanks


Sean

Sunday, March 9, 2014  |  From CSLA .NET Contrib

Hi,


One of the great things about CSLA, in my opinion, is the ability to write multiple clients across different platforms.


Does anyone have practical experience they could share when making a breaking change in the business assembly while supporting multiple legacy clients (Web, WinForms, WPF and  Android to be specific)?


Thanks,


Matthew

 CSLA .NET Contrib News Feed 

 Code-gen Templates News Feed 
Wednesday, April 9, 2014  |  From Code-gen Templates

When my private backing field SetProperty is called...even though it is ByRef, the value in mDTO.EvidNum does not change until AFTER the PropertyHasChanged runs.


This means that a simple rule like StringRequired runs and sees an empty string and the rule stays broken.  But the next step after rules running is that the mDTO.EvidNum property setter is called.  So you look at the business object and the rule is broken but there is a value there.


Any ideas?  I assume the CSLA code assumes a private backing field is just a string not a Class.StringProperty.


 


I have the following code:


    Private Shared EvidNumPropertyInfo As PropertyInfo(Of String) = RegisterProperty(Of String)(Function(c) c.EvidNum, RelationshipTypes.PrivateField)


    Public Property EvidNum() As String


        Get


            Return GetProperty(EvidNumPropertyInfo, mDTO.EvidNum)


        End
Get


        Set(ByVal value As String)


            SetProperty(EvidNumPropertyInfo,
mDTO.EvidNum, value)


        End
Set













Normal
0




false
false
false

EN-US
JA
X-NONE






















































































































































































    End
Property


 

Monday, April 7, 2014  |  From Code-gen Templates

I am not sure if I posted this question before or somebody posted it, but somehow I cannot find the discussion.


We had lots of in-house applications that uses CSLA 3.0.6, .NET Framework 3.5/4, VS2010.  Would it possible to upgrade all of those to the latest CSLA version (4.5.501), .NET Framework 4.5 and VS 2012?


One our concern are there lots of validation and business rules in any of the project.


Thanks.

Monday, April 7, 2014  |  From Code-gen Templates

So CSLA with iOS is in "beta" or in the initial stages of becoming possible - I do believe by looking at a pamphlet from Xamarin that they also drive Mac OS native applications.  I have a question out to someone at Xamarin as to whether these would be two different projects and native app buildouts in the solution (I'm guessing they would be).


In thinking about advocating for the Xamarin approach here, I wanted to see what the envisioned CSLA support for Mac OS would be.  Is that basically done when iOS became potentially supported or is this another ball of wax?

Thursday, April 3, 2014  |  From Code-gen Templates

Hello everyone,


I have developed wcf .net 4 REST service that uses the wcf dataportal. Both services
are hosted in IIS 7 in same web app.  Parts of the web.config are enclosed at the end of this message.  


My wcf service runs successfully on ASP.NET developer server, but not in the IIS web server.  When accessing an API from web browser on port 80, I keep receiving this exception message:


Exception has been thrown by the target of an invocation


Would you have any ideas why could this be happening?  


 


The web,config:


<?xml version="1.0"?>


<configuration>


  <appSettings>


    <add key="MyDbName" value="MY_DB" />


    <add key="CslaAuthentication" value="Csla"/>


  </appSettings>


  <connectionStrings/>


  <system.serviceModel>


    <protocolMapping>


      <add scheme="http" binding="webHttpBinding" />


    </protocolMapping>


    <behaviors>


      <serviceBehaviors>


        <behavior name="WebServiceBehavior">


          <serviceMetadata httpGetEnabled="true"/>


          <serviceDebug includeExceptionDetailInFaults="true"/>


        </behavior>


        <behavior name="returnFaults">


          <serviceDebug includeExceptionDetailInFaults="true" />


        </behavior>


      </serviceBehaviors>


      <endpointBehaviors>


        <behavior name="RESTEndpointBehavior">


          <webHttp />


        </behavior>


      </endpointBehaviors>


    </behaviors>


    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" minFreeMemoryPercentageToActivateService="1" />


    <services>


      <service behaviorConfiguration="WebServiceBehavior" name="Something">


        <endpoint address="" binding="webHttpBinding" contract="ISomethingContract" behaviorConfiguration="RESTEndpointBehavior" />


        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>


        <host>


          <baseAddresses>


            <add baseAddress="http://localhost:8000" />


          </baseAddresses>


        </host>


      </service>


      <service name="Csla.Server.Hosts.WcfPortal" behaviorConfiguration="returnFaults">


        <endpoint binding="wsHttpBinding" contract="Csla.Server.Hosts.IWcfPortal" bindingConfiguration="WSHttpBinding_IWebService"/>


      </service>


    </services>


    <bindings>


      <wsHttpBinding>


        <binding name="WSHttpBinding_IWebService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">


          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>


          <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/>


          <security mode="None">


            <transport clientCredentialType="None"/>


          </security>


        </binding>


      </wsHttpBinding>


    </bindings>    


  </system.serviceModel>


  <system.web>


    <sessionState mode="InProc" cookieless="true" regenerateExpiredSessionId="false" timeout="20"/>


    <compilation debug="true" targetFramework="4.0">


    </compilation>


    <authentication mode="Windows"/>


       <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>


  </system.web> 



</configuration>



 


Thank you in advance,
Tanja


PS. The web site is setup in the ASP.NET v4.0 Application pool  (Integrated managed pipeline mode and ApplicationPoolIdentity for indenty) and the WcfPortal.svc is located in the same location where my svc file is.

Friday, March 28, 2014  |  From Code-gen Templates

Hi,


 


I am new to CSLA. And got stuck up.


 


i am getting the following error when using the Entity frameework.


 


Error 1 The type 'ShasPatho.DalEf.ShasPathoEntities' cannot be used as type parameter 'C' in the generic type or method 'Csla.Data.ObjectContextManager<C>'. There is no implicit reference conversion from 'ShasPatho.DalEf.ShasPathoEntities' to 'System.Data.Objects.ObjectContext'.


 


any help would be great.


 


regards


 


ashish


Wednesday, March 26, 2014  |  From Code-gen Templates

Microsoft is interested in buying Xamarian.  More MVVM frameworks are now working better with PCL and multi platform solutions such as MVVMCROSS.  With these changes in the multi platform arena, has there been any readdressing of the issue of building a CSLA Core module compatible with Portable Class Libraries?  I am now having to face the decision of leaving behind my beloved CSLA.

Tuesday, March 25, 2014  |  From Code-gen Templates

I have a created a Read Only Lists that inherits from CSLA ReadOnlyListBase. I am calling a BeginGet method passing in a criteria class (both classes have been marked as serializable).


This fetch does work on the first call, however any subsequent calls of the same method are causing the error below:


ERROR MESSAGE:


{: at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result) at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result) at System.ServiceModel.ClientBase1.ChannelBase1.EndInvoke(String methodName, Object[] args, IAsyncResult result) at Csla.WcfPortal.WcfPortalClient.WcfPortalClientChannel.EndFetch(IAsyncResult result) at Csla.WcfPortal.WcfPortalClient.Csla.WcfPortal.IWcfPortal.EndFetch(IAsyncResult result) at Csla.WcfPortal.WcfPortalClient.OnEndFetch(IAsyncResult result) at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result) : Error HRESULT E_FAIL has been returned from a call to a COM component. at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult) at System.Net.Browser.BrowserHttpWebRequest.<>c_DisplayClassa.b_9(Object sendState) at System.Net.Browser.AsyncHelper.<>c_DisplayClass4.b_0(Object sendState) }


My breakpoint on the DataPortal_Fetch method is not being hit (after the first fetch) on the server side, as the error indicates. 


Any advice to help me solve this would be appreciated.

Friday, March 21, 2014  |  From Code-gen Templates

Hi guys,


I think I have an interesting one.  I have been reading many, many discussions on this topic and altering my code and have found an interesting quirk.  Below are the most useful discussions I've read and taken ideas from.


http://forums.lhotka.net/forums/p/12036/56156.aspx


http://forums.lhotka.net/forums/p/8931/42494.aspx


I have a .NET 4.5, CSLA 4.5.40, Silverlight 5, IIS 7.5 application that has been working terrifically locally but I've been trying to deploy to a webserver.  My AppPool settings have gone through every possible permutation but I have settled with Integrated and Identity: LocalSystem.  If I change the identity it gives similar results as mentioned below but with a different system account.  IIS site authentication only has ASP .NET Impersonation and Windows Authentication Enabled.


Here is the web.config with all the tags that have been identified as required:


<?xml version="1.0" encoding="utf-8"?>


<configuration>


  <appSettings>


    <add key="EventLogName" value="GreyDev" />


    <add key="CslaAuthentication" value="Windows"/>


    <add key="CslaWriter" value="Csla.Serialization.Mobile.CslaBinaryWriter, Csla" />


    <add key="CslaReader" value="Csla.Serialization.Mobile.CslaBinaryReader, Csla" />


  </appSettings>


  <connectionStrings>


PRIVATE :)


  </connectionStrings>


  <system.web>


    <compilation debug="true" targetFramework="4.5" />


    <authentication mode="Windows" />


    <identity impersonate="true" />


    <pages controlRenderingCompatibilityVersion="4.0"/>


  </system.web>


  <system.webServer>


    <validation validateIntegratedModeConfiguration="false" />


  </system.webServer>


  <system.serviceModel>


    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" />


    <services>


      <service behaviorConfiguration="WcfPortalBehavior" name="Business.Compression.CompressedHost">


        <endpoint binding="basicHttpBinding" contract="Csla.Server.Hosts.Mobile.IWcfPortal" bindingConfiguration="BasicHttpBinding_IWcfPortal" />


      </service>


    </services>


    <behaviors>


      <serviceBehaviors>


        <behavior name="WcfPortalBehavior">


          <serviceDebug includeExceptionDetailInFaults="true" />


 <serviceAuthorization impersonateCallerForAllOperations="true" />


        </behavior>


      </serviceBehaviors>


    </behaviors>


    <bindings>


      <basicHttpBinding>


        <binding name="BasicHttpBinding_IWcfPortal" 


maxReceivedMessageSize="2147483647"


                   maxBufferPoolSize="2147483647"


                   maxBufferSize="2147483647" >


          <readerQuotas maxBytesPerRead="2147483647"


                          maxArrayLength="2147483647"


                          maxStringContentLength="2147483647"


                          maxNameTableCharCount="2147483647"


                          maxDepth="2147483647" />


          <security mode="TransportCredentialOnly">


            <transport clientCredentialType="Windows" />


          </security>


        </binding>


      </basicHttpBinding>


    </bindings>


  </system.serviceModel>


</configuration>




On to my results.  In my AppIdentity class I call the CSLA method PopulateWindowsIdentity().  Digging into this method I found that the main call to retrieve the impersonated windows user is:  var currentUser = System.Security.Principal.WindowsIdentity.GetCurrent();

No matter what config, IIS or AppPool settings I have changed, the returned WindowsIdentity.Name is always "NT AUTHORITY\SYSTEM" (this varies when changing the AppPool Identity as mentioned before).  It never impersonated the user, in my case 'speters' (my AD name).  I have made a small ASP web app with the same config and IIS settings and in that app, Impersonation works!  In that application, I have found that the web.config setting <identity impersonate="true" /> directly turns off or on the Impersonation with the true/false setting.


After 3 days of trying every setting I could find, reading every article I could find, I decided to call another method in my AppIdentity class, var cslaname = Csla.ApplicationContext.User.Identity.Name.

This Csla.ApplicationContext call successfully retreives my Impersonated AD credentials.  With this information I have managed to check the result of both Identity calls and choose the one that is needed, so technically my applicaton is working.  However, I still would love to know what it takes to get the WindowsIdentity to properly Impersonate.


In Summary, with all the above settings:

System.Security.Principal.WindowsIdentity.GetCurrent().Name; Does NOT Impersonate Client User AD

Csla.ApplicationContext.User.Identity.Name;  Does Impersonate/Fetch Client User AD


Any thoughts on whats happening here?

 

Friday, March 21, 2014  |  From Code-gen Templates

I've noticed that
short-circuiting rules in CSLA 4.5.501.0 is not working. That is when I
set prioritization to my business rules then set the
ProcessThroughPriority. When I query the Broken Rules I get all invalid
rules even those that has higher priority than ProcessThroughPriority
value. Is there a newer way of doing it?

Thursday, March 20, 2014  |  From Code-gen Templates

Hi,


Before upgrading from 4 to 4.5, exceptions coming back from the data portal would have the message of the original exception such as "Another user has modified the row in Table1, update failed".  Now all that comes back as the message is than an Async Error occurred.  There is no detail as to the problem.  What is the method that people are using to return the original message such as a table update failed back to the client?


Todd Haehn

Wednesday, March 19, 2014  |  From Code-gen Templates

I had assumed that SafeDataReader would convert any null strings coming from SQL Server into String.Empty.

But after finding some app exceptions logged, I have confirmed that null values from the database are being set to Nothing (vb.net) in their properties. I don't want to have to deal with null/Nothing in string properties.

Am I doing something wrong?

The code I am using was generated by CodeSmith, using encapsulated implementation. It uses a SafeDataReader, and in this case it passes it to a Map routine.

Something like this:

LoadProperty(_LongDescriptionProperty, reader.Item("LongDescription"))


Will break my app if I try something like:

Foo.LongDescription.Trim, because it will throw an exception.

Am I doing something wrong? I'd hate to have to write a bunch of code to check for null values, and convert them to empty strings.


Thanks.

FWIW, I'm a longtime user of CSLA (since VB6 days). Not on every project, but on quite a few, in different industries. It's a great tool.


 


 

Wednesday, March 19, 2014  |  From Code-gen Templates

Hi there,


Need some clarification on this statement from previous post:


My key issue is that there is a LOT you must make sure to NOT use, such as the standard rules, the CslaContrib rules 
or the CslaGenFork rules.

Refresh of my situation:


  • I am using DTO from my DAL as a private field in BusinessBase object.  The individual PropertyInfo objects are marked with PrivateField and the Getters/Setters use the GetProperty and SetProperty.
  • I cannot bring myself to write a LoadProperty/ReadProperty overload for every property!  It is too unmaintainable unless I only had a couple properties.

Currently I am using the CommonRules and they work great!!  Only the DataAnnotation rules do not work.  I debugged the CommonRule, the execution does a Using ByPassPropertyChecks and then calls my getter on the primary property using the DynamicMethodGetter.


Given the following parameters (question below)


  • I do not use Async rules
  • I do not use the CSLAContrib or CSLAGenFork rules
  • I do not use Input or OutputProperties
  • I do not target async clients (WinRt, WPhone, Silverlight)
  • If I DO ever write an async rule with no Target access OR if I use input/output properties I will do Load/ReadProperty overload for the few relevant properties

Am I missing something?  Thanks for patience as I understand the guts of what is going on. 


This code is screaming fast and I like not having to load my business object properties one by one from the DAL layer at fetch and update!  Yes my DTO is tied into my BusinessLayer, but I am willing to live with that for the benefit.


Extra benefit is I want to spin up a ReadOnly version I can transfer the DTO to a ReadOnly Friend factory method and viola!

Tuesday, March 18, 2014  |  From Code-gen Templates

Hi,


Hopefully this question will have better success than the last....


I have table called GP. 
Two of the fields are called IsCurrentOption and GPPracticeId .


The GPPracticeId is a foreign key to the GPPractice
table.  A GPPractice also has an IsCurrentOption
field.


I have a rule that if the GP record is related to a GPPractice
with the IsCurrentOption  = false then
the GP must have IsCurrentOption = false.


I’ve created a Dynamic Root List based on the GP table.  This has rules in places to deal with the
scenario above and that all works well.


In my list I want to stop the user from being able to edit
the IsCurrentOption field if the associated GPPractice is IsCurrentOption  = false.


I created a custom Authorization rule to deal with that
scenario. 


When the list is loaded the rule is evaluated and the IsCurrentOption
property is readonly where appropriate.


If the GPPractice is changed to a GPPractice that has IsCurrentOption
 = true my Authorization rule is not checked.  Instead the BusinessBase will consult its
cache and get the value from the last time the rule was checked.  It’s not until the BusinessBase is saved (I’m
assuming  putting the BusinessBase  through the data portal loses its cache as the
caches are not serialised), will the rule be checked and return the correct
result.


I couldn’t see any way of forcing my rule to be checked when
the properties are changed.


 


Any idea’s how I can resolve this issue? 


Many thanks,


Nathan

Tuesday, March 18, 2014  |  From Code-gen Templates

I said sometime this week, and Kevin really worked hard on this, so the 4.5.580 pre-release with iOS support (via Xamarin tools) is now on nuget and GitHub:


http://www.lhotka.net/weblog/CSLANETBetaReleaseSupportingIOS.aspx


 

Monday, March 17, 2014  |  From Code-gen Templates

We're closing in on a version of CSLA .NET that works on iOS using the Xamarin tools.


This is the result of a lot of work by Stuart Bale, Kevin Ford, and myself, and Kevin is getting very close to where we can release a beta version - hopefully yet this week.


If you have Xamarin for iOS I hope you'll help us test this out, but we're very excited!!

Sunday, March 16, 2014  |  From Code-gen Templates

Rockford Lhotka says:


"Collections do not support direct declaration of properties, so you can’t implement properties in this class. If properties are required in addition to the list of child objects, you should create an editable parent object that contains the collection, along with those other properties and their rules."


 


So, I decided to check this out.


I've declared simply property in my inherited BusinessBindingListBase. Somethink like this:


property long DocId { get; set; }


 


I can do "Fetch" and "Update". And it works. My custom property always persist.


But I'm working with 2-tier mode.


 


Maybe it will not work in 3-tier? What reasons could stop me from using custom properties in BusinessBindingListBase?

Saturday, March 15, 2014  |  From Code-gen Templates

If I add a private variable on my BusinessListBase...how or can I serialize it so it is still there on the other side of the WCF portal?


Say like this?


TestList BusinessListBase(of Test)


private mTestString as String


I assumed the BusinessListBase would preserve and serialize variable just like BusinessBase but apparently not.


I am tracking a list of issues to report to the parent when IParent is set in SetParent after DataPortal call.  I override SetParent and alert the root parent in there.


Any ideas


Sean

Thursday, March 13, 2014  |  From Code-gen Templates

Hello Everyone,


We have upgraded the CSLA version from "2.1.4" to "3.5.3", after testing the csla new changes in the developer environment we recently pushed our changes to the QA environment and after pushing the changes we started getting few errors. Basically after pushing the changes to QA environment all our projects got build successfully including the upgraded CSLA project but when we try to access our site we are getting the below error:


Error:


"Could not load file or assembly 'csla, version=2.1.4.0, culture=neutral, PublicKeyToken=93be5fdc093e4c30'or one of its dependencies. The located assembly's manifest defination does not match the assembly reference. (Exception from HRESULT: 0x80131040)".


What is the actual cause of this issue? As the CSLA project has been successfully build then why after using this csla.dll refrence in other Libraries we are still getting the above issue? 


Kindly help us to resolve the above mentioned issue, as we did not got any proper solution to fix this issue till now.  


Thanks for your help in advance.

Wednesday, March 12, 2014  |  From Code-gen Templates

Working on a project where there is missing Ref Int on the SQL database.  Business objects have to handle scenario of missing data by IDs.  (ugh I know).


During lazyload of child collection, if I detect there is some piece of data missing from the DB, I skip loading that child.


But I would like to provide feedback (Warning rule) on Parent that alerts user that the BusinessObjects have detected a referential integrity problem and what are the IDs associated with the problem.  This would give the customer some very helpful information to give to their DBA to go fix the issue.


How would I have the child collection tell the root/parent to break a warning rule with relevant info?


How would I write the rule on the root/parent so it only gets broken when the child collection says so.


Seems like broken rules is a good place to put this, maybe I am wrong?



Thanks


Sean

Sunday, March 9, 2014  |  From Code-gen Templates

Hi,


One of the great things about CSLA, in my opinion, is the ability to write multiple clients across different platforms.


Does anyone have practical experience they could share when making a breaking change in the business assembly while supporting multiple legacy clients (Web, WinForms, WPF and  Android to be specific)?


Thanks,


Matthew

 Code-gen Templates News Feed 

 VS Templates News Feed 
Wednesday, April 9, 2014  |  From VS Templates

When my private backing field SetProperty is called...even though it is ByRef, the value in mDTO.EvidNum does not change until AFTER the PropertyHasChanged runs.


This means that a simple rule like StringRequired runs and sees an empty string and the rule stays broken.  But the next step after rules running is that the mDTO.EvidNum property setter is called.  So you look at the business object and the rule is broken but there is a value there.


Any ideas?  I assume the CSLA code assumes a private backing field is just a string not a Class.StringProperty.


 


I have the following code:


    Private Shared EvidNumPropertyInfo As PropertyInfo(Of String) = RegisterProperty(Of String)(Function(c) c.EvidNum, RelationshipTypes.PrivateField)


    Public Property EvidNum() As String


        Get


            Return GetProperty(EvidNumPropertyInfo, mDTO.EvidNum)


        End
Get


        Set(ByVal value As String)


            SetProperty(EvidNumPropertyInfo,
mDTO.EvidNum, value)


        End
Set













Normal
0




false
false
false

EN-US
JA
X-NONE






















































































































































































    End
Property


 

Monday, April 7, 2014  |  From VS Templates

I am not sure if I posted this question before or somebody posted it, but somehow I cannot find the discussion.


We had lots of in-house applications that uses CSLA 3.0.6, .NET Framework 3.5/4, VS2010.  Would it possible to upgrade all of those to the latest CSLA version (4.5.501), .NET Framework 4.5 and VS 2012?


One our concern are there lots of validation and business rules in any of the project.


Thanks.

Monday, April 7, 2014  |  From VS Templates

So CSLA with iOS is in "beta" or in the initial stages of becoming possible - I do believe by looking at a pamphlet from Xamarin that they also drive Mac OS native applications.  I have a question out to someone at Xamarin as to whether these would be two different projects and native app buildouts in the solution (I'm guessing they would be).


In thinking about advocating for the Xamarin approach here, I wanted to see what the envisioned CSLA support for Mac OS would be.  Is that basically done when iOS became potentially supported or is this another ball of wax?

Thursday, April 3, 2014  |  From VS Templates

Hello everyone,


I have developed wcf .net 4 REST service that uses the wcf dataportal. Both services
are hosted in IIS 7 in same web app.  Parts of the web.config are enclosed at the end of this message.  


My wcf service runs successfully on ASP.NET developer server, but not in the IIS web server.  When accessing an API from web browser on port 80, I keep receiving this exception message:


Exception has been thrown by the target of an invocation


Would you have any ideas why could this be happening?  


 


The web,config:


<?xml version="1.0"?>


<configuration>


  <appSettings>


    <add key="MyDbName" value="MY_DB" />


    <add key="CslaAuthentication" value="Csla"/>


  </appSettings>


  <connectionStrings/>


  <system.serviceModel>


    <protocolMapping>


      <add scheme="http" binding="webHttpBinding" />


    </protocolMapping>


    <behaviors>


      <serviceBehaviors>


        <behavior name="WebServiceBehavior">


          <serviceMetadata httpGetEnabled="true"/>


          <serviceDebug includeExceptionDetailInFaults="true"/>


        </behavior>


        <behavior name="returnFaults">


          <serviceDebug includeExceptionDetailInFaults="true" />


        </behavior>


      </serviceBehaviors>


      <endpointBehaviors>


        <behavior name="RESTEndpointBehavior">


          <webHttp />


        </behavior>


      </endpointBehaviors>


    </behaviors>


    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" minFreeMemoryPercentageToActivateService="1" />


    <services>


      <service behaviorConfiguration="WebServiceBehavior" name="Something">


        <endpoint address="" binding="webHttpBinding" contract="ISomethingContract" behaviorConfiguration="RESTEndpointBehavior" />


        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>


        <host>


          <baseAddresses>


            <add baseAddress="http://localhost:8000" />


          </baseAddresses>


        </host>


      </service>


      <service name="Csla.Server.Hosts.WcfPortal" behaviorConfiguration="returnFaults">


        <endpoint binding="wsHttpBinding" contract="Csla.Server.Hosts.IWcfPortal" bindingConfiguration="WSHttpBinding_IWebService"/>


      </service>


    </services>


    <bindings>


      <wsHttpBinding>


        <binding name="WSHttpBinding_IWebService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">


          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>


          <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/>


          <security mode="None">


            <transport clientCredentialType="None"/>


          </security>


        </binding>


      </wsHttpBinding>


    </bindings>    


  </system.serviceModel>


  <system.web>


    <sessionState mode="InProc" cookieless="true" regenerateExpiredSessionId="false" timeout="20"/>


    <compilation debug="true" targetFramework="4.0">


    </compilation>


    <authentication mode="Windows"/>


       <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>


  </system.web> 



</configuration>



 


Thank you in advance,
Tanja


PS. The web site is setup in the ASP.NET v4.0 Application pool  (Integrated managed pipeline mode and ApplicationPoolIdentity for indenty) and the WcfPortal.svc is located in the same location where my svc file is.

Friday, March 28, 2014  |  From VS Templates

Hi,


 


I am new to CSLA. And got stuck up.


 


i am getting the following error when using the Entity frameework.


 


Error 1 The type 'ShasPatho.DalEf.ShasPathoEntities' cannot be used as type parameter 'C' in the generic type or method 'Csla.Data.ObjectContextManager<C>'. There is no implicit reference conversion from 'ShasPatho.DalEf.ShasPathoEntities' to 'System.Data.Objects.ObjectContext'.


 


any help would be great.


 


regards


 


ashish


Wednesday, March 26, 2014  |  From VS Templates

Microsoft is interested in buying Xamarian.  More MVVM frameworks are now working better with PCL and multi platform solutions such as MVVMCROSS.  With these changes in the multi platform arena, has there been any readdressing of the issue of building a CSLA Core module compatible with Portable Class Libraries?  I am now having to face the decision of leaving behind my beloved CSLA.

Tuesday, March 25, 2014  |  From VS Templates

I have a created a Read Only Lists that inherits from CSLA ReadOnlyListBase. I am calling a BeginGet method passing in a criteria class (both classes have been marked as serializable).


This fetch does work on the first call, however any subsequent calls of the same method are causing the error below:


ERROR MESSAGE:


{: at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result) at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result) at System.ServiceModel.ClientBase1.ChannelBase1.EndInvoke(String methodName, Object[] args, IAsyncResult result) at Csla.WcfPortal.WcfPortalClient.WcfPortalClientChannel.EndFetch(IAsyncResult result) at Csla.WcfPortal.WcfPortalClient.Csla.WcfPortal.IWcfPortal.EndFetch(IAsyncResult result) at Csla.WcfPortal.WcfPortalClient.OnEndFetch(IAsyncResult result) at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result) : Error HRESULT E_FAIL has been returned from a call to a COM component. at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult) at System.Net.Browser.BrowserHttpWebRequest.<>c_DisplayClassa.b_9(Object sendState) at System.Net.Browser.AsyncHelper.<>c_DisplayClass4.b_0(Object sendState) }


My breakpoint on the DataPortal_Fetch method is not being hit (after the first fetch) on the server side, as the error indicates. 


Any advice to help me solve this would be appreciated.

Friday, March 21, 2014  |  From VS Templates

Hi guys,


I think I have an interesting one.  I have been reading many, many discussions on this topic and altering my code and have found an interesting quirk.  Below are the most useful discussions I've read and taken ideas from.


http://forums.lhotka.net/forums/p/12036/56156.aspx


http://forums.lhotka.net/forums/p/8931/42494.aspx


I have a .NET 4.5, CSLA 4.5.40, Silverlight 5, IIS 7.5 application that has been working terrifically locally but I've been trying to deploy to a webserver.  My AppPool settings have gone through every possible permutation but I have settled with Integrated and Identity: LocalSystem.  If I change the identity it gives similar results as mentioned below but with a different system account.  IIS site authentication only has ASP .NET Impersonation and Windows Authentication Enabled.


Here is the web.config with all the tags that have been identified as required:


<?xml version="1.0" encoding="utf-8"?>


<configuration>


  <appSettings>


    <add key="EventLogName" value="GreyDev" />


    <add key="CslaAuthentication" value="Windows"/>


    <add key="CslaWriter" value="Csla.Serialization.Mobile.CslaBinaryWriter, Csla" />


    <add key="CslaReader" value="Csla.Serialization.Mobile.CslaBinaryReader, Csla" />


  </appSettings>


  <connectionStrings>


PRIVATE :)


  </connectionStrings>


  <system.web>


    <compilation debug="true" targetFramework="4.5" />


    <authentication mode="Windows" />


    <identity impersonate="true" />


    <pages controlRenderingCompatibilityVersion="4.0"/>


  </system.web>


  <system.webServer>


    <validation validateIntegratedModeConfiguration="false" />


  </system.webServer>


  <system.serviceModel>


    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" />


    <services>


      <service behaviorConfiguration="WcfPortalBehavior" name="Business.Compression.CompressedHost">


        <endpoint binding="basicHttpBinding" contract="Csla.Server.Hosts.Mobile.IWcfPortal" bindingConfiguration="BasicHttpBinding_IWcfPortal" />


      </service>


    </services>


    <behaviors>


      <serviceBehaviors>


        <behavior name="WcfPortalBehavior">


          <serviceDebug includeExceptionDetailInFaults="true" />


 <serviceAuthorization impersonateCallerForAllOperations="true" />


        </behavior>


      </serviceBehaviors>


    </behaviors>


    <bindings>


      <basicHttpBinding>


        <binding name="BasicHttpBinding_IWcfPortal" 


maxReceivedMessageSize="2147483647"


                   maxBufferPoolSize="2147483647"


                   maxBufferSize="2147483647" >


          <readerQuotas maxBytesPerRead="2147483647"


                          maxArrayLength="2147483647"


                          maxStringContentLength="2147483647"


                          maxNameTableCharCount="2147483647"


                          maxDepth="2147483647" />


          <security mode="TransportCredentialOnly">


            <transport clientCredentialType="Windows" />


          </security>


        </binding>


      </basicHttpBinding>


    </bindings>


  </system.serviceModel>


</configuration>




On to my results.  In my AppIdentity class I call the CSLA method PopulateWindowsIdentity().  Digging into this method I found that the main call to retrieve the impersonated windows user is:  var currentUser = System.Security.Principal.WindowsIdentity.GetCurrent();

No matter what config, IIS or AppPool settings I have changed, the returned WindowsIdentity.Name is always "NT AUTHORITY\SYSTEM" (this varies when changing the AppPool Identity as mentioned before).  It never impersonated the user, in my case 'speters' (my AD name).  I have made a small ASP web app with the same config and IIS settings and in that app, Impersonation works!  In that application, I have found that the web.config setting <identity impersonate="true" /> directly turns off or on the Impersonation with the true/false setting.


After 3 days of trying every setting I could find, reading every article I could find, I decided to call another method in my AppIdentity class, var cslaname = Csla.ApplicationContext.User.Identity.Name.

This Csla.ApplicationContext call successfully retreives my Impersonated AD credentials.  With this information I have managed to check the result of both Identity calls and choose the one that is needed, so technically my applicaton is working.  However, I still would love to know what it takes to get the WindowsIdentity to properly Impersonate.


In Summary, with all the above settings:

System.Security.Principal.WindowsIdentity.GetCurrent().Name; Does NOT Impersonate Client User AD

Csla.ApplicationContext.User.Identity.Name;  Does Impersonate/Fetch Client User AD


Any thoughts on whats happening here?

 

Friday, March 21, 2014  |  From VS Templates

I've noticed that
short-circuiting rules in CSLA 4.5.501.0 is not working. That is when I
set prioritization to my business rules then set the
ProcessThroughPriority. When I query the Broken Rules I get all invalid
rules even those that has higher priority than ProcessThroughPriority
value. Is there a newer way of doing it?

Thursday, March 20, 2014  |  From VS Templates

Hi,


Before upgrading from 4 to 4.5, exceptions coming back from the data portal would have the message of the original exception such as "Another user has modified the row in Table1, update failed".  Now all that comes back as the message is than an Async Error occurred.  There is no detail as to the problem.  What is the method that people are using to return the original message such as a table update failed back to the client?


Todd Haehn

Wednesday, March 19, 2014  |  From VS Templates

I had assumed that SafeDataReader would convert any null strings coming from SQL Server into String.Empty.

But after finding some app exceptions logged, I have confirmed that null values from the database are being set to Nothing (vb.net) in their properties. I don't want to have to deal with null/Nothing in string properties.

Am I doing something wrong?

The code I am using was generated by CodeSmith, using encapsulated implementation. It uses a SafeDataReader, and in this case it passes it to a Map routine.

Something like this:

LoadProperty(_LongDescriptionProperty, reader.Item("LongDescription"))


Will break my app if I try something like:

Foo.LongDescription.Trim, because it will throw an exception.

Am I doing something wrong? I'd hate to have to write a bunch of code to check for null values, and convert them to empty strings.


Thanks.

FWIW, I'm a longtime user of CSLA (since VB6 days). Not on every project, but on quite a few, in different industries. It's a great tool.


 


 

Wednesday, March 19, 2014  |  From VS Templates

Hi there,


Need some clarification on this statement from previous post:


My key issue is that there is a LOT you must make sure to NOT use, such as the standard rules, the CslaContrib rules 
or the CslaGenFork rules.

Refresh of my situation:


  • I am using DTO from my DAL as a private field in BusinessBase object.  The individual PropertyInfo objects are marked with PrivateField and the Getters/Setters use the GetProperty and SetProperty.
  • I cannot bring myself to write a LoadProperty/ReadProperty overload for every property!  It is too unmaintainable unless I only had a couple properties.

Currently I am using the CommonRules and they work great!!  Only the DataAnnotation rules do not work.  I debugged the CommonRule, the execution does a Using ByPassPropertyChecks and then calls my getter on the primary property using the DynamicMethodGetter.


Given the following parameters (question below)


  • I do not use Async rules
  • I do not use the CSLAContrib or CSLAGenFork rules
  • I do not use Input or OutputProperties
  • I do not target async clients (WinRt, WPhone, Silverlight)
  • If I DO ever write an async rule with no Target access OR if I use input/output properties I will do Load/ReadProperty overload for the few relevant properties

Am I missing something?  Thanks for patience as I understand the guts of what is going on. 


This code is screaming fast and I like not having to load my business object properties one by one from the DAL layer at fetch and update!  Yes my DTO is tied into my BusinessLayer, but I am willing to live with that for the benefit.


Extra benefit is I want to spin up a ReadOnly version I can transfer the DTO to a ReadOnly Friend factory method and viola!

Tuesday, March 18, 2014  |  From VS Templates

Hi,


Hopefully this question will have better success than the last....


I have table called GP. 
Two of the fields are called IsCurrentOption and GPPracticeId .


The GPPracticeId is a foreign key to the GPPractice
table.  A GPPractice also has an IsCurrentOption
field.


I have a rule that if the GP record is related to a GPPractice
with the IsCurrentOption  = false then
the GP must have IsCurrentOption = false.


I’ve created a Dynamic Root List based on the GP table.  This has rules in places to deal with the
scenario above and that all works well.


In my list I want to stop the user from being able to edit
the IsCurrentOption field if the associated GPPractice is IsCurrentOption  = false.


I created a custom Authorization rule to deal with that
scenario. 


When the list is loaded the rule is evaluated and the IsCurrentOption
property is readonly where appropriate.


If the GPPractice is changed to a GPPractice that has IsCurrentOption
 = true my Authorization rule is not checked.  Instead the BusinessBase will consult its
cache and get the value from the last time the rule was checked.  It’s not until the BusinessBase is saved (I’m
assuming  putting the BusinessBase  through the data portal loses its cache as the
caches are not serialised), will the rule be checked and return the correct
result.


I couldn’t see any way of forcing my rule to be checked when
the properties are changed.


 


Any idea’s how I can resolve this issue? 


Many thanks,


Nathan

Tuesday, March 18, 2014  |  From VS Templates

I said sometime this week, and Kevin really worked hard on this, so the 4.5.580 pre-release with iOS support (via Xamarin tools) is now on nuget and GitHub:


http://www.lhotka.net/weblog/CSLANETBetaReleaseSupportingIOS.aspx


 

Monday, March 17, 2014  |  From VS Templates

We're closing in on a version of CSLA .NET that works on iOS using the Xamarin tools.


This is the result of a lot of work by Stuart Bale, Kevin Ford, and myself, and Kevin is getting very close to where we can release a beta version - hopefully yet this week.


If you have Xamarin for iOS I hope you'll help us test this out, but we're very excited!!

Sunday, March 16, 2014  |  From VS Templates

Rockford Lhotka says:


"Collections do not support direct declaration of properties, so you can’t implement properties in this class. If properties are required in addition to the list of child objects, you should create an editable parent object that contains the collection, along with those other properties and their rules."


 


So, I decided to check this out.


I've declared simply property in my inherited BusinessBindingListBase. Somethink like this:


property long DocId { get; set; }


 


I can do "Fetch" and "Update". And it works. My custom property always persist.


But I'm working with 2-tier mode.


 


Maybe it will not work in 3-tier? What reasons could stop me from using custom properties in BusinessBindingListBase?

Saturday, March 15, 2014  |  From VS Templates

If I add a private variable on my BusinessListBase...how or can I serialize it so it is still there on the other side of the WCF portal?


Say like this?


TestList BusinessListBase(of Test)


private mTestString as String


I assumed the BusinessListBase would preserve and serialize variable just like BusinessBase but apparently not.


I am tracking a list of issues to report to the parent when IParent is set in SetParent after DataPortal call.  I override SetParent and alert the root parent in there.


Any ideas


Sean

Thursday, March 13, 2014  |  From VS Templates

Hello Everyone,


We have upgraded the CSLA version from "2.1.4" to "3.5.3", after testing the csla new changes in the developer environment we recently pushed our changes to the QA environment and after pushing the changes we started getting few errors. Basically after pushing the changes to QA environment all our projects got build successfully including the upgraded CSLA project but when we try to access our site we are getting the below error:


Error:


"Could not load file or assembly 'csla, version=2.1.4.0, culture=neutral, PublicKeyToken=93be5fdc093e4c30'or one of its dependencies. The located assembly's manifest defination does not match the assembly reference. (Exception from HRESULT: 0x80131040)".


What is the actual cause of this issue? As the CSLA project has been successfully build then why after using this csla.dll refrence in other Libraries we are still getting the above issue? 


Kindly help us to resolve the above mentioned issue, as we did not got any proper solution to fix this issue till now.  


Thanks for your help in advance.

Wednesday, March 12, 2014  |  From VS Templates

Working on a project where there is missing Ref Int on the SQL database.  Business objects have to handle scenario of missing data by IDs.  (ugh I know).


During lazyload of child collection, if I detect there is some piece of data missing from the DB, I skip loading that child.


But I would like to provide feedback (Warning rule) on Parent that alerts user that the BusinessObjects have detected a referential integrity problem and what are the IDs associated with the problem.  This would give the customer some very helpful information to give to their DBA to go fix the issue.


How would I have the child collection tell the root/parent to break a warning rule with relevant info?


How would I write the rule on the root/parent so it only gets broken when the child collection says so.


Seems like broken rules is a good place to put this, maybe I am wrong?



Thanks


Sean

Sunday, March 9, 2014  |  From VS Templates

Hi,


One of the great things about CSLA, in my opinion, is the ability to write multiple clients across different platforms.


Does anyone have practical experience they could share when making a breaking change in the business assembly while supporting multiple legacy clients (Web, WinForms, WPF and  Android to be specific)?


Thanks,


Matthew

 VS Templates News Feed 

Last edited Jan 18, 2007 at 6:55 PM by RockfordLhotka, version 2

Comments

No comments yet.