CSLA .NET Contrib News Feed 
Monday, July 28, 2014  |  From CSLA .NET Contrib

Anybody was successful on creating a template for Texbox with CSLA ?? We are having trouble with DataTrigger using Behaviors SDK XAML version 12.0


We've tried to adapt the one here


http://forums.lhotka.net/forums/p/11633/53888.aspx#53888


unsuccessfully :-\

Monday, July 28, 2014  |  From CSLA .NET Contrib

 


Please :


I dont anderstand why in the projecttracker sample in class


RoleEditList


the method


    protected override RoleEdit AddNewCore()
        {
            RoleEdit item = RoleEditManager.NewRoleEdit();
            Add(item);
            return item;
        }


in not called when I add a new row in the datagrid.


I need custmiz the new item.


Best regards


Alejandro


the datagrid is in WPF.

Monday, July 28, 2014  |  From CSLA .NET Contrib

 


Please :


I dont anderstand why in the projecttracker sample in class


RoleEditList


the method


    protected override RoleEdit AddNewCore()
        {
            RoleEdit item = RoleEditManager.NewRoleEdit();
            Add(item);
            return item;
        }


in not called when I add a new row in the datagrid.


I need custmiz the new item.


Best regards


Alejandro


 

Monday, July 28, 2014  |  From CSLA .NET Contrib

I'm finding that when I first start up my application the first client dataportal usage PER TYPE, is very slow.


So, for example, the first Fetch of MyObject takes around 800ms, whereas every subsequent MyObject takes around 250ms (the server is in a different location).  If I then Fetch MyOtherObject (without restarting the application), this first usage is slow, but subsequent usages are fine.


The server is running at all times using a SelfHosted server (not IIS) so should be fully up and running and with no startup delays, so I don't believe that the server-side is affecting things.


I've had a look around at the usual suspects for first WCF usage being slow, but neither seems to make a difference:


- proxy detection (I don't have a proxy and have tried setting the relevant config file things to disable)


- serialization (I have tried forcing serialization of MyObject manually before first using the DataPortal)


 


I am not specifying a serializer, so I think this means that it will be using BinaryFormatter.  I have my DataPortal configured to use NetTcp with transport level security.


The thing is, if this was slow for the first usage for ALL objects (i.e. the first usage of the first type is slow, but aftewards everything is fine), I would assume this is a WCF thing, but because the first usage of every type is slow, it makes me think this has something to do with CSLA and the way it does things.


This is also the same in a Release build after ngen-ing the binaries.


Does anyone have any other ideas for what could be causing this?  Does anyone else see the same issue?


Could it be to do with the fact that the WCF service is based upon reflection (dynamic typing) and how the serialization handles this?


 


 


 

Thursday, July 24, 2014  |  From CSLA .NET Contrib

I've set up static Auth Rules on my object by creating a method on it:


     public static void AddObjectAuthorizationRules()


In which I add to the static BusinessRules collection:


     BusinessRules.AddRule(typeof(MyObject), ... etc


 


I have CSLA set for 3-Tier usage, and I can see that the Authorization rules get checked in the client when the DataPortal is used.


However, when it hits the server DataPortal it doesn't seem check the rules.  As this will be a publicly available server, I need it to check the rules on the server too.


Is there an easy way to configure the server DataPortal to also check the Authorization rules? I couldn't see anything in the CSLA books. 


I am using 4.5.501.0

Tuesday, July 22, 2014  |  From CSLA .NET Contrib

Hi


I have a screen in Silverlight which is comprised of a header record, and then a datagrid which might contain up to 1000 records.


The user doesn't want to use paging and would prefer to just scroll down the list of records in the datagrid and enter a value in one of the cells for what could be just a handful of records.


When the user clicks Save the entire object is transported back to the server, including the 1000 odd records. This is resulting in some poor performance (even with compression).


Is there any technique you might suggest to handle this kind of suggestion?


The question is being asked..."why are we transporting back every record if we're only editing three?". 


Thanks 


Damien

Friday, July 18, 2014  |  From CSLA .NET Contrib

Hello I use to add validation rule to my object just with a function and add that function to the broken  rules list , now if i understood well i have to create a class that inherits from business rules, and create an execute method that validate the rule, My version of CSLA was 1.3 or something. Is this the only way to add broken rules? 

Wednesday, July 16, 2014  |  From CSLA .NET Contrib

I've the following object graph:


Client Singleton
Charges Collection
Payments Collection
ChargePayments Collection


The Client object has the 3 collections as child objects.
The Charges collection holds a collection of all charges to the client.
The Payment collection holds a collection of all payments to the client.
The ChargePayments collection manages the many to many relationships bewteen Charges and Payments.


The balance on a charge is the total of all amount applied to that charge as located in the ChargePayments collection.
The amount applied for a payment is the total of all amount applied for that payment located in the ChargePayments collection.


When a payment is deleted (this can happen while creating the record) all the ChargePayments related to that payment are deleted which means the totals on any Charges that used that payment need to be updated.
Likewise, if a charge is deleted the ChargePayments related to that Charge are deleted and the amount applied for each of the Payments needs to be updated.


Long story short, the removal of items in the ChargePayments collection (and addition of items) needs to cause each member of the Charges and Payments collections to update their totals.


POSSIBLE FIXES
1: Should this be managed by the parent object such that the parent Client object flips through children collections updating values
2: Should each Charge and each Payment have a reference to the ChargePayments collection and update themselves when the ChargePayments collection changes
3: Is there a better way altogether to handle this?


Tuesday, July 15, 2014  |  From CSLA .NET Contrib

My team and I have been using CSLA.NET for a while now and recently we got the requirement to update how roles are processed.


In classic ASP.NET Membership you have a role.  For simplicity, let's just say it is the "ReadOnly" role.  To limit BusinessBase authorization for the that role, you would do something like the following:


protected static void AddObjectAuthorizationRules() {
    string[] read = new string[] { "ReadOnly" };
    Csla.Rules.BusinessRules.AddRule(typeof(LookUp), new Csla.Rules.CommonRules.IsInRole(Csla.Rules.AuthorizationActions.GetObject, read));
}

Our new role structure appends a user's Department to the role so now our roles look like "DeptName:RoleName".  We have the roles populating in our custom membership code/tables and we have a way to check the roles.  Here is what we will be implementing (code brevity to keep focus on the question's scope; new code is bolded):


protected static void AddObjectAuthorizationRules() {
    List<string> readUsers = new List<string>() { "ReadOnly"};
    Csla.Rules.BusinessRules.AddRule(typeof(LookUp), new Csla.Rules.CommonRules.IsInRole(Csla.Rules.AuthorizationActions.GetObject, ProcessAuthorizationRoles(readUsers)));
}

private static List<string> ProcessAuthorizationRoles(List<string> pDefinedRoles) {
    List<string> _userRoles = ((CustomIdentityClass)Csla.ApplicationContext.User.Identity).Roles;

    return _userRoles.FindAll(x => pDefinedRoles.Exists(y => x.Contains(string.Format(":{0}", y))));
}


How we can keep our code DRY within the CSLA framework without having to implement the same function (ProcessAuthorizationRoles) in each BusinessBase object?


Thanks in advance!

Tuesday, July 15, 2014  |  From CSLA .NET Contrib

Hello,


we are currently refactoring our client application to a SOA (ASP.NET MVC, Web Service, new HTTP Channel)


We make use of DynamicBindingListBase, but it does not support async save.


Is this intended, what should be do?


 


Thanks in advance


Blue

Monday, July 14, 2014  |  From CSLA .NET Contrib

Hy


I'm try to build a multi UI n-tiers sofware based on CSLA 4.5.600. I have a root object with a child list of child-objects. My solution is as follow:


- a business library based on recently "Shared" project concept built on Visual Studio 2013 u2 


- a WCFHost localhost server with WCFPortal.svc and SlPortal.svc


- a MVC5AppServer localhost server with HttpProxy


- client UI: WPF, Wp8, Universal App (WinRT and WP8.1)


This is a test solution before to start a very important project based on above configuration (maybe Azure also server option) that will start in the next months.


Everything of above work perfectly except when in WPF Client i insert a new child object. Probably, the new object is not serialized on server. In fact the root object on client side IsValid,it is IsSavable and the child list contains the new object but when I put a breakpoint on DataPortal_Update(), Server side (WCFHost), the root object is not dirty and child list don't contains the new object. Instead, when I tried to Update and Delete Child Objects these work perfectly. I have this problem only on WPF (CSLA settings are in App.config file) - WCFPortal.svc. WP8Client-SlPortal.svc work fine. Also Universal App (WinRT 8.1 and WP8.1) with MVC5AppServer, they work as I expected.


What can I try to discover where there is a bug on my solution?


Regards, Rolando 

Saturday, July 12, 2014  |  From CSLA .NET Contrib

Hello:


I was using CSLA 3.6 now I want to start a new project using CSLA 4.5.501.


Can anybody give a link with first steps?


My first dilemma is I don't which DLL files I must use:


-those which are in Marimer LLC\CSLA .NET\4.5.501\Bin\NET4


-those which are in Marimer LLC\CSLA .NET\4.5.501\Bin\NET


 


What about differents versions of EF?


I have all the CSLA 4 books. Is in there what am I looking for?


 


Thanks a lot


 

Monday, July 07, 2014  |  From CSLA .NET Contrib

Good day.


i have a strange issue, i have a quotation (invoice) form with child lines. if i add new lines and save it works perfectly, if i delete a line and save this too works fine. but i find that if i delete a couple if lines click save and then add new lines and click save the lines the deleted item are not deleted properly and the new lines are just saved to the database. what could be causing this issue? am i supposed to manually clear my deleted lines list at some point?i also fined that if i have 4 saved lines to begin with and click save that all 4 lines are saved, if i then remove 2 lines and save 2 lines are removed from the database, but if i then click add to create a new line and click save the deleted lines are put back and saved to the database. i should only have 3 lines in the table but i end up with  5 lines (2 original lines, 1 newly inserted line and the 2 lines previously deleted)


i have this code in my QuotationFactory:


public void UpdateChildren(QuotationLineList obj, Quotation q)
        {
          
            foreach (var item in GetDeletedList<QuotationLine>(obj))
            {
                this.Update(item, q);
            }

            foreach (QuotationLine item in obj)
            {
                this.Update(item, q);
            }
        }


which calls the following:


public QuotationLine Update(QuotationLine obj, Quotation q)
        {

            if (obj.IsDeleted)
            {
                if (!obj.IsNew)
                {
                    ExecuteDelete(obj.ID);
                
                }
                MarkNew(obj);
            }
            else
            {
                if (obj.IsNew)
                {
                    //Insert New data
                    obj.QUID = q.Id;
                    ExecuteInsert(obj);
                   
                }
                else
                {
                    //Update existing data
                    ExecuteUpdate(obj);
                  
                }
            }

           
          
            return obj;
        }


any help regarding this would be much appreciated.


 


 

Monday, July 07, 2014  |  From CSLA .NET Contrib

Hello Guys !


My Question is:


Are there any important benefits to Update from 4.5.3 to 4.5.6 for WPF Application ?


Thank You for an answer !


Thilo

Monday, July 07, 2014  |  From CSLA .NET Contrib

There is a problem with using WinForm BindingSource in the newest CSLA version (4.5.x). For BindingSource used in master-detail scenario, the CurrentChanged event is raised many times, when the property is changed on child object.


It can be easily reproduced on sample "RootChildGrandchildWinFormTest". Just add event handlers and breakpoints on all BindingSource.CurrentChanged events and try modify 1st-level child property. Event is raised many times for both child binding source and grandchild binding source (for every property defined on object).


in older versions (4.3.x, 3.8.x) it works fine (event is raised only one-time for GrandChild object)

Thursday, July 03, 2014  |  From CSLA .NET Contrib

Hello,


I have a silverlight application that is in a stable (production) state running Csla 4.5.40. I am using the Factory Implementation (ObjectFactory).


I needed to make some changes today so I updated all NuGet packages on the application and all of it's libraries. This upgraded the application to 4.5.600. I only made one code change to handle DataPortalException.ErrorInfo is now HttpErrorInfo instead of WCFErrorInfo. This change isn't impacting my issue as a DataPortalException is never received.


After updating the NuGet packages however if there is an exception (any exception) in the DAL leads to the following exception in Silverlight:


Property load or set failed for property Message (Exception of type 'System.OutOfMemoryException' was thrown.)   at Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task)
   at Microsoft.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Microsoft.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Csla.DataPortal`1.<BeginFetch>d__1e.MoveNext()


I cannot figure out the cause. Even doing "throw new Exception("Test");" immediatly in the DAL fetch method leads to this. None of my code runs between exception being raised in the DAL and receiving the above exception in Silverlight. I am stumped. If there is a DAL exception in the version running Csla 4.5.40 I get a  DataPortalException object as expected.


Thank you for your help.

Thursday, July 03, 2014  |  From CSLA .NET Contrib

Im using csla v1.1.4322 and Im triying to upgrade to csla v4.5 in my List Im using csla.core.BusinessCollectionBase when i changed the references to my project to pint to the new csla my list Objects started to fail It can find BusinessCollectionBase. Can some one help me?


 

Thursday, July 03, 2014  |  From CSLA .NET Contrib

I raised a previous post about SaveAsync() not working. I boiled this down to a configuration setting..."CslaAutoCloneOnUpdate" if this is false then SaveAsync doesn't work. I have test cases to validate. I know this is a legacy setting but there are aspects of our code that require this until they can be fixed.


Secondly if calling SaveAsync() in an asp.net Web API controller in my test case. After the call HttpContext is null. Before the call it's fine. This pretty much breaks everything as the user has no identity.


I've had issues with threading before with CSLA background workers but never where HttpContext becomes null?

Thursday, July 03, 2014  |  From CSLA .NET Contrib

So I've been trying to implement the new SaveAsync() methods in 4.5.6. There is not much info or guidance on how these should be used, or not that I can find anyway.


I always get an error "DataPortal.Update failed (TemplateEdit.IsBusy == true)"


On debugging the DataPortal Update is marking the object as busy and then bailing before it ends.


public async Task<Model> Post(Modelmodel)
        {

            // do something to create and populate an object
            ...
            obj = await obj.SaveAsync();
            return new Model(obj);
        }


Its as simple as that. DataPortal_XYZ are the regular ol' voids etc. Is this correct?

There are no business rules so I've ruled (pardon the pun) them out.

Thursday, July 03, 2014  |  From CSLA .NET Contrib

hello..


I have a sql server scalar function which returns server datetime.


I want to assign its value to a datetime property in DalEf project's Insert().


What is the syntax for it?

 CSLA .NET Contrib News Feed 

 Code-gen Templates News Feed 
Thursday, July 24, 2014  |  From Code-gen Templates

I've set up static Auth Rules on my object by creating a method on it:


     public static void AddObjectAuthorizationRules()


In which I add to the static BusinessRules collection:


     BusinessRules.AddRule(typeof(MyObject), ... etc


 


I have CSLA set for 3-Tier usage, and I can see that the Authorization rules get checked in the client when the DataPortal is used.


However, when it hits the server DataPortal it doesn't seem check the rules.  As this will be a publicly available server, I need it to check the rules on the server too.


Is there an easy way to configure the server DataPortal to also check the Authorization rules? I couldn't see anything in the CSLA books. 


I am using 4.5.501.0

Tuesday, July 22, 2014  |  From Code-gen Templates

Hi


I have a screen in Silverlight which is comprised of a header record, and then a datagrid which might contain up to 1000 records.


The user doesn't want to use paging and would prefer to just scroll down the list of records in the datagrid and enter a value in one of the cells for what could be just a handful of records.


When the user clicks Save the entire object is transported back to the server, including the 1000 odd records. This is resulting in some poor performance (even with compression).


Is there any technique you might suggest to handle this kind of suggestion?


The question is being asked..."why are we transporting back every record if we're only editing three?". 


Thanks 


Damien

Friday, July 18, 2014  |  From Code-gen Templates

Hello I use to add validation rule to my object just with a function and add that function to the broken  rules list , now if i understood well i have to create a class that inherits from business rules, and create an execute method that validate the rule, My version of CSLA was 1.3 or something. Is this the only way to add broken rules? 

Wednesday, July 16, 2014  |  From Code-gen Templates

I've the following object graph:


Client Singleton
Charges Collection
Payments Collection
ChargePayments Collection


The Client object has the 3 collections as child objects.
The Charges collection holds a collection of all charges to the client.
The Payment collection holds a collection of all payments to the client.
The ChargePayments collection manages the many to many relationships bewteen Charges and Payments.


The balance on a charge is the total of all amount applied to that charge as located in the ChargePayments collection.
The amount applied for a payment is the total of all amount applied for that payment located in the ChargePayments collection.


When a payment is deleted (this can happen while creating the record) all the ChargePayments related to that payment are deleted which means the totals on any Charges that used that payment need to be updated.
Likewise, if a charge is deleted the ChargePayments related to that Charge are deleted and the amount applied for each of the Payments needs to be updated.


Long story short, the removal of items in the ChargePayments collection (and addition of items) needs to cause each member of the Charges and Payments collections to update their totals.


POSSIBLE FIXES
1: Should this be managed by the parent object such that the parent Client object flips through children collections updating values
2: Should each Charge and each Payment have a reference to the ChargePayments collection and update themselves when the ChargePayments collection changes
3: Is there a better way altogether to handle this?


Tuesday, July 15, 2014  |  From Code-gen Templates

My team and I have been using CSLA.NET for a while now and recently we got the requirement to update how roles are processed.


In classic ASP.NET Membership you have a role.  For simplicity, let's just say it is the "ReadOnly" role.  To limit BusinessBase authorization for the that role, you would do something like the following:


protected static void AddObjectAuthorizationRules() {
    string[] read = new string[] { "ReadOnly" };
    Csla.Rules.BusinessRules.AddRule(typeof(LookUp), new Csla.Rules.CommonRules.IsInRole(Csla.Rules.AuthorizationActions.GetObject, read));
}

Our new role structure appends a user's Department to the role so now our roles look like "DeptName:RoleName".  We have the roles populating in our custom membership code/tables and we have a way to check the roles.  Here is what we will be implementing (code brevity to keep focus on the question's scope; new code is bolded):


protected static void AddObjectAuthorizationRules() {
    List<string> readUsers = new List<string>() { "ReadOnly"};
    Csla.Rules.BusinessRules.AddRule(typeof(LookUp), new Csla.Rules.CommonRules.IsInRole(Csla.Rules.AuthorizationActions.GetObject, ProcessAuthorizationRoles(readUsers)));
}

private static List<string> ProcessAuthorizationRoles(List<string> pDefinedRoles) {
    List<string> _userRoles = ((CustomIdentityClass)Csla.ApplicationContext.User.Identity).Roles;

    return _userRoles.FindAll(x => pDefinedRoles.Exists(y => x.Contains(string.Format(":{0}", y))));
}


How we can keep our code DRY within the CSLA framework without having to implement the same function (ProcessAuthorizationRoles) in each BusinessBase object?


Thanks in advance!

Tuesday, July 15, 2014  |  From Code-gen Templates

Hello,


we are currently refactoring our client application to a SOA (ASP.NET MVC, Web Service, new HTTP Channel)


We make use of DynamicBindingListBase, but it does not support async save.


Is this intended, what should be do?


 


Thanks in advance


Blue

Monday, July 14, 2014  |  From Code-gen Templates

Hy


I'm try to build a multi UI n-tiers sofware based on CSLA 4.5.600. I have a root object with a child list of child-objects. My solution is as follow:


- a business library based on recently "Shared" project concept built on Visual Studio 2013 u2 


- a WCFHost localhost server with WCFPortal.svc and SlPortal.svc


- a MVC5AppServer localhost server with HttpProxy


- client UI: WPF, Wp8, Universal App (WinRT and WP8.1)


This is a test solution before to start a very important project based on above configuration (maybe Azure also server option) that will start in the next months.


Everything of above work perfectly except when in WPF Client i insert a new child object. Probably, the new object is not serialized on server. In fact the root object on client side IsValid,it is IsSavable and the child list contains the new object but when I put a breakpoint on DataPortal_Update(), Server side (WCFHost), the root object is not dirty and child list don't contains the new object. Instead, when I tried to Update and Delete Child Objects these work perfectly. I have this problem only on WPF (CSLA settings are in App.config file) - WCFPortal.svc. WP8Client-SlPortal.svc work fine. Also Universal App (WinRT 8.1 and WP8.1) with MVC5AppServer, they work as I expected.


What can I try to discover where there is a bug on my solution?


Regards, Rolando 

Saturday, July 12, 2014  |  From Code-gen Templates

Hello:


I was using CSLA 3.6 now I want to start a new project using CSLA 4.5.501.


Can anybody give a link with first steps?


My first dilemma is I don't which DLL files I must use:


-those which are in Marimer LLC\CSLA .NET\4.5.501\Bin\NET4


-those which are in Marimer LLC\CSLA .NET\4.5.501\Bin\NET


 


What about differents versions of EF?


I have all the CSLA 4 books. Is in there what am I looking for?


 


Thanks a lot


 

Monday, July 07, 2014  |  From Code-gen Templates

Good day.


i have a strange issue, i have a quotation (invoice) form with child lines. if i add new lines and save it works perfectly, if i delete a line and save this too works fine. but i find that if i delete a couple if lines click save and then add new lines and click save the lines the deleted item are not deleted properly and the new lines are just saved to the database. what could be causing this issue? am i supposed to manually clear my deleted lines list at some point?i also fined that if i have 4 saved lines to begin with and click save that all 4 lines are saved, if i then remove 2 lines and save 2 lines are removed from the database, but if i then click add to create a new line and click save the deleted lines are put back and saved to the database. i should only have 3 lines in the table but i end up with  5 lines (2 original lines, 1 newly inserted line and the 2 lines previously deleted)


i have this code in my QuotationFactory:


public void UpdateChildren(QuotationLineList obj, Quotation q)
        {
          
            foreach (var item in GetDeletedList<QuotationLine>(obj))
            {
                this.Update(item, q);
            }

            foreach (QuotationLine item in obj)
            {
                this.Update(item, q);
            }
        }


which calls the following:


public QuotationLine Update(QuotationLine obj, Quotation q)
        {

            if (obj.IsDeleted)
            {
                if (!obj.IsNew)
                {
                    ExecuteDelete(obj.ID);
                
                }
                MarkNew(obj);
            }
            else
            {
                if (obj.IsNew)
                {
                    //Insert New data
                    obj.QUID = q.Id;
                    ExecuteInsert(obj);
                   
                }
                else
                {
                    //Update existing data
                    ExecuteUpdate(obj);
                  
                }
            }

           
          
            return obj;
        }


any help regarding this would be much appreciated.


 


 

Monday, July 07, 2014  |  From Code-gen Templates

Hello Guys !


My Question is:


Are there any important benefits to Update from 4.5.3 to 4.5.6 for WPF Application ?


Thank You for an answer !


Thilo

Monday, July 07, 2014  |  From Code-gen Templates

There is a problem with using WinForm BindingSource in the newest CSLA version (4.5.x). For BindingSource used in master-detail scenario, the CurrentChanged event is raised many times, when the property is changed on child object.


It can be easily reproduced on sample "RootChildGrandchildWinFormTest". Just add event handlers and breakpoints on all BindingSource.CurrentChanged events and try modify 1st-level child property. Event is raised many times for both child binding source and grandchild binding source (for every property defined on object).


in older versions (4.3.x, 3.8.x) it works fine (event is raised only one-time for GrandChild object)

Thursday, July 03, 2014  |  From Code-gen Templates

Hello,


I have a silverlight application that is in a stable (production) state running Csla 4.5.40. I am using the Factory Implementation (ObjectFactory).


I needed to make some changes today so I updated all NuGet packages on the application and all of it's libraries. This upgraded the application to 4.5.600. I only made one code change to handle DataPortalException.ErrorInfo is now HttpErrorInfo instead of WCFErrorInfo. This change isn't impacting my issue as a DataPortalException is never received.


After updating the NuGet packages however if there is an exception (any exception) in the DAL leads to the following exception in Silverlight:


Property load or set failed for property Message (Exception of type 'System.OutOfMemoryException' was thrown.)   at Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task)
   at Microsoft.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Microsoft.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Csla.DataPortal`1.<BeginFetch>d__1e.MoveNext()


I cannot figure out the cause. Even doing "throw new Exception("Test");" immediatly in the DAL fetch method leads to this. None of my code runs between exception being raised in the DAL and receiving the above exception in Silverlight. I am stumped. If there is a DAL exception in the version running Csla 4.5.40 I get a  DataPortalException object as expected.


Thank you for your help.

Thursday, July 03, 2014  |  From Code-gen Templates

Im using csla v1.1.4322 and Im triying to upgrade to csla v4.5 in my List Im using csla.core.BusinessCollectionBase when i changed the references to my project to pint to the new csla my list Objects started to fail It can find BusinessCollectionBase. Can some one help me?


 

Thursday, July 03, 2014  |  From Code-gen Templates

I raised a previous post about SaveAsync() not working. I boiled this down to a configuration setting..."CslaAutoCloneOnUpdate" if this is false then SaveAsync doesn't work. I have test cases to validate. I know this is a legacy setting but there are aspects of our code that require this until they can be fixed.


Secondly if calling SaveAsync() in an asp.net Web API controller in my test case. After the call HttpContext is null. Before the call it's fine. This pretty much breaks everything as the user has no identity.


I've had issues with threading before with CSLA background workers but never where HttpContext becomes null?

Thursday, July 03, 2014  |  From Code-gen Templates

So I've been trying to implement the new SaveAsync() methods in 4.5.6. There is not much info or guidance on how these should be used, or not that I can find anyway.


I always get an error "DataPortal.Update failed (TemplateEdit.IsBusy == true)"


On debugging the DataPortal Update is marking the object as busy and then bailing before it ends.


public async Task<Model> Post(Modelmodel)
        {

            // do something to create and populate an object
            ...
            obj = await obj.SaveAsync();
            return new Model(obj);
        }


Its as simple as that. DataPortal_XYZ are the regular ol' voids etc. Is this correct?

There are no business rules so I've ruled (pardon the pun) them out.

Thursday, July 03, 2014  |  From Code-gen Templates

hello..


I have a sql server scalar function which returns server datetime.


I want to assign its value to a datetime property in DalEf project's Insert().


What is the syntax for it?

Thursday, July 03, 2014  |  From Code-gen Templates

Not able to display error/warn/Info messages to user(UI) with asp.net webapplication?


How can i display Business rule required field error message to user ?


Any Example with webapplication will help me?

Tuesday, July 01, 2014  |  From Code-gen Templates

I have created property status control for my Model property. When I removed the business rules of the corresponding properties from AddBusinessValidationRules(). It is not working.


 


Is it mandatory a business rule for showing propertystatus . Else some settings is available?


Please confirm

Monday, June 30, 2014  |  From Code-gen Templates

I noticed that the ConnectionManager issues a lock on a static object in the GetManager() call, which on first run calls the constructor that in turns calls Open() on the new connection, a potentially "long" operation.


This seems to create a bottleneck on a busy web site, when GetManager gets called from many threads at the same time. In this scenario I don't see a need for locking, as all requests are running on their own thread (read; having their own private LocalContext - HttpContext.Items).


Any thoughts on this issue?


Regards;
/jb 

Monday, June 23, 2014  |  From Code-gen Templates

I'm trying to have my WinRT app connect securely to a remote data portal over https, for obvious reasons. Up till now I've been testing internally without SSL, but when I start to test using a secured address I get the following error:


The provided URI scheme 'https' is invalid; expected 'http'. Parameter name: via Csla.DataPortalClient.WcfProxy.<Fetch>d__8.MoveNext():0


I'm assuming this is because my client isn't configured to use the same wcf bindings the server uses. This wouldn't be a problem for .NET because I'd add those settings in the config file, or in the clientconfig in a SL app. How do I set the WCF bindings correctly within a WinRT app?


I recall this recent thread with this response by Rocky: http://forums.lhotka.net/forums/p/11201/57463.aspx#57463. It somewhat speaks to issues with Universal apps not being able to do this, but I'm not using building a Universal app. Is configuring the WCF bindings in the app.xaml.cs a possibility? Hopefully I'm not forced into using the BrokeredProxy model. Thanks.

 Code-gen Templates News Feed 

 VS Templates News Feed 
Thursday, July 24, 2014  |  From VS Templates

I've set up static Auth Rules on my object by creating a method on it:


     public static void AddObjectAuthorizationRules()


In which I add to the static BusinessRules collection:


     BusinessRules.AddRule(typeof(MyObject), ... etc


 


I have CSLA set for 3-Tier usage, and I can see that the Authorization rules get checked in the client when the DataPortal is used.


However, when it hits the server DataPortal it doesn't seem check the rules.  As this will be a publicly available server, I need it to check the rules on the server too.


Is there an easy way to configure the server DataPortal to also check the Authorization rules? I couldn't see anything in the CSLA books. 


I am using 4.5.501.0

Tuesday, July 22, 2014  |  From VS Templates

Hi


I have a screen in Silverlight which is comprised of a header record, and then a datagrid which might contain up to 1000 records.


The user doesn't want to use paging and would prefer to just scroll down the list of records in the datagrid and enter a value in one of the cells for what could be just a handful of records.


When the user clicks Save the entire object is transported back to the server, including the 1000 odd records. This is resulting in some poor performance (even with compression).


Is there any technique you might suggest to handle this kind of suggestion?


The question is being asked..."why are we transporting back every record if we're only editing three?". 


Thanks 


Damien

Friday, July 18, 2014  |  From VS Templates

Hello I use to add validation rule to my object just with a function and add that function to the broken  rules list , now if i understood well i have to create a class that inherits from business rules, and create an execute method that validate the rule, My version of CSLA was 1.3 or something. Is this the only way to add broken rules? 

Wednesday, July 16, 2014  |  From VS Templates

I've the following object graph:


Client Singleton
Charges Collection
Payments Collection
ChargePayments Collection


The Client object has the 3 collections as child objects.
The Charges collection holds a collection of all charges to the client.
The Payment collection holds a collection of all payments to the client.
The ChargePayments collection manages the many to many relationships bewteen Charges and Payments.


The balance on a charge is the total of all amount applied to that charge as located in the ChargePayments collection.
The amount applied for a payment is the total of all amount applied for that payment located in the ChargePayments collection.


When a payment is deleted (this can happen while creating the record) all the ChargePayments related to that payment are deleted which means the totals on any Charges that used that payment need to be updated.
Likewise, if a charge is deleted the ChargePayments related to that Charge are deleted and the amount applied for each of the Payments needs to be updated.


Long story short, the removal of items in the ChargePayments collection (and addition of items) needs to cause each member of the Charges and Payments collections to update their totals.


POSSIBLE FIXES
1: Should this be managed by the parent object such that the parent Client object flips through children collections updating values
2: Should each Charge and each Payment have a reference to the ChargePayments collection and update themselves when the ChargePayments collection changes
3: Is there a better way altogether to handle this?


Tuesday, July 15, 2014  |  From VS Templates

My team and I have been using CSLA.NET for a while now and recently we got the requirement to update how roles are processed.


In classic ASP.NET Membership you have a role.  For simplicity, let's just say it is the "ReadOnly" role.  To limit BusinessBase authorization for the that role, you would do something like the following:


protected static void AddObjectAuthorizationRules() {
    string[] read = new string[] { "ReadOnly" };
    Csla.Rules.BusinessRules.AddRule(typeof(LookUp), new Csla.Rules.CommonRules.IsInRole(Csla.Rules.AuthorizationActions.GetObject, read));
}

Our new role structure appends a user's Department to the role so now our roles look like "DeptName:RoleName".  We have the roles populating in our custom membership code/tables and we have a way to check the roles.  Here is what we will be implementing (code brevity to keep focus on the question's scope; new code is bolded):


protected static void AddObjectAuthorizationRules() {
    List<string> readUsers = new List<string>() { "ReadOnly"};
    Csla.Rules.BusinessRules.AddRule(typeof(LookUp), new Csla.Rules.CommonRules.IsInRole(Csla.Rules.AuthorizationActions.GetObject, ProcessAuthorizationRoles(readUsers)));
}

private static List<string> ProcessAuthorizationRoles(List<string> pDefinedRoles) {
    List<string> _userRoles = ((CustomIdentityClass)Csla.ApplicationContext.User.Identity).Roles;

    return _userRoles.FindAll(x => pDefinedRoles.Exists(y => x.Contains(string.Format(":{0}", y))));
}


How we can keep our code DRY within the CSLA framework without having to implement the same function (ProcessAuthorizationRoles) in each BusinessBase object?


Thanks in advance!

Tuesday, July 15, 2014  |  From VS Templates

Hello,


we are currently refactoring our client application to a SOA (ASP.NET MVC, Web Service, new HTTP Channel)


We make use of DynamicBindingListBase, but it does not support async save.


Is this intended, what should be do?


 


Thanks in advance


Blue

Monday, July 14, 2014  |  From VS Templates

Hy


I'm try to build a multi UI n-tiers sofware based on CSLA 4.5.600. I have a root object with a child list of child-objects. My solution is as follow:


- a business library based on recently "Shared" project concept built on Visual Studio 2013 u2 


- a WCFHost localhost server with WCFPortal.svc and SlPortal.svc


- a MVC5AppServer localhost server with HttpProxy


- client UI: WPF, Wp8, Universal App (WinRT and WP8.1)


This is a test solution before to start a very important project based on above configuration (maybe Azure also server option) that will start in the next months.


Everything of above work perfectly except when in WPF Client i insert a new child object. Probably, the new object is not serialized on server. In fact the root object on client side IsValid,it is IsSavable and the child list contains the new object but when I put a breakpoint on DataPortal_Update(), Server side (WCFHost), the root object is not dirty and child list don't contains the new object. Instead, when I tried to Update and Delete Child Objects these work perfectly. I have this problem only on WPF (CSLA settings are in App.config file) - WCFPortal.svc. WP8Client-SlPortal.svc work fine. Also Universal App (WinRT 8.1 and WP8.1) with MVC5AppServer, they work as I expected.


What can I try to discover where there is a bug on my solution?


Regards, Rolando 

Saturday, July 12, 2014  |  From VS Templates

Hello:


I was using CSLA 3.6 now I want to start a new project using CSLA 4.5.501.


Can anybody give a link with first steps?


My first dilemma is I don't which DLL files I must use:


-those which are in Marimer LLC\CSLA .NET\4.5.501\Bin\NET4


-those which are in Marimer LLC\CSLA .NET\4.5.501\Bin\NET


 


What about differents versions of EF?


I have all the CSLA 4 books. Is in there what am I looking for?


 


Thanks a lot


 

Monday, July 07, 2014  |  From VS Templates

Good day.


i have a strange issue, i have a quotation (invoice) form with child lines. if i add new lines and save it works perfectly, if i delete a line and save this too works fine. but i find that if i delete a couple if lines click save and then add new lines and click save the lines the deleted item are not deleted properly and the new lines are just saved to the database. what could be causing this issue? am i supposed to manually clear my deleted lines list at some point?i also fined that if i have 4 saved lines to begin with and click save that all 4 lines are saved, if i then remove 2 lines and save 2 lines are removed from the database, but if i then click add to create a new line and click save the deleted lines are put back and saved to the database. i should only have 3 lines in the table but i end up with  5 lines (2 original lines, 1 newly inserted line and the 2 lines previously deleted)


i have this code in my QuotationFactory:


public void UpdateChildren(QuotationLineList obj, Quotation q)
        {
          
            foreach (var item in GetDeletedList<QuotationLine>(obj))
            {
                this.Update(item, q);
            }

            foreach (QuotationLine item in obj)
            {
                this.Update(item, q);
            }
        }


which calls the following:


public QuotationLine Update(QuotationLine obj, Quotation q)
        {

            if (obj.IsDeleted)
            {
                if (!obj.IsNew)
                {
                    ExecuteDelete(obj.ID);
                
                }
                MarkNew(obj);
            }
            else
            {
                if (obj.IsNew)
                {
                    //Insert New data
                    obj.QUID = q.Id;
                    ExecuteInsert(obj);
                   
                }
                else
                {
                    //Update existing data
                    ExecuteUpdate(obj);
                  
                }
            }

           
          
            return obj;
        }


any help regarding this would be much appreciated.


 


 

Monday, July 07, 2014  |  From VS Templates

Hello Guys !


My Question is:


Are there any important benefits to Update from 4.5.3 to 4.5.6 for WPF Application ?


Thank You for an answer !


Thilo

Monday, July 07, 2014  |  From VS Templates

There is a problem with using WinForm BindingSource in the newest CSLA version (4.5.x). For BindingSource used in master-detail scenario, the CurrentChanged event is raised many times, when the property is changed on child object.


It can be easily reproduced on sample "RootChildGrandchildWinFormTest". Just add event handlers and breakpoints on all BindingSource.CurrentChanged events and try modify 1st-level child property. Event is raised many times for both child binding source and grandchild binding source (for every property defined on object).


in older versions (4.3.x, 3.8.x) it works fine (event is raised only one-time for GrandChild object)

Thursday, July 03, 2014  |  From VS Templates

Hello,


I have a silverlight application that is in a stable (production) state running Csla 4.5.40. I am using the Factory Implementation (ObjectFactory).


I needed to make some changes today so I updated all NuGet packages on the application and all of it's libraries. This upgraded the application to 4.5.600. I only made one code change to handle DataPortalException.ErrorInfo is now HttpErrorInfo instead of WCFErrorInfo. This change isn't impacting my issue as a DataPortalException is never received.


After updating the NuGet packages however if there is an exception (any exception) in the DAL leads to the following exception in Silverlight:


Property load or set failed for property Message (Exception of type 'System.OutOfMemoryException' was thrown.)   at Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task)
   at Microsoft.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Microsoft.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Csla.DataPortal`1.<BeginFetch>d__1e.MoveNext()


I cannot figure out the cause. Even doing "throw new Exception("Test");" immediatly in the DAL fetch method leads to this. None of my code runs between exception being raised in the DAL and receiving the above exception in Silverlight. I am stumped. If there is a DAL exception in the version running Csla 4.5.40 I get a  DataPortalException object as expected.


Thank you for your help.

Thursday, July 03, 2014  |  From VS Templates

Im using csla v1.1.4322 and Im triying to upgrade to csla v4.5 in my List Im using csla.core.BusinessCollectionBase when i changed the references to my project to pint to the new csla my list Objects started to fail It can find BusinessCollectionBase. Can some one help me?


 

Thursday, July 03, 2014  |  From VS Templates

I raised a previous post about SaveAsync() not working. I boiled this down to a configuration setting..."CslaAutoCloneOnUpdate" if this is false then SaveAsync doesn't work. I have test cases to validate. I know this is a legacy setting but there are aspects of our code that require this until they can be fixed.


Secondly if calling SaveAsync() in an asp.net Web API controller in my test case. After the call HttpContext is null. Before the call it's fine. This pretty much breaks everything as the user has no identity.


I've had issues with threading before with CSLA background workers but never where HttpContext becomes null?

Thursday, July 03, 2014  |  From VS Templates

So I've been trying to implement the new SaveAsync() methods in 4.5.6. There is not much info or guidance on how these should be used, or not that I can find anyway.


I always get an error "DataPortal.Update failed (TemplateEdit.IsBusy == true)"


On debugging the DataPortal Update is marking the object as busy and then bailing before it ends.


public async Task<Model> Post(Modelmodel)
        {

            // do something to create and populate an object
            ...
            obj = await obj.SaveAsync();
            return new Model(obj);
        }


Its as simple as that. DataPortal_XYZ are the regular ol' voids etc. Is this correct?

There are no business rules so I've ruled (pardon the pun) them out.

Thursday, July 03, 2014  |  From VS Templates

hello..


I have a sql server scalar function which returns server datetime.


I want to assign its value to a datetime property in DalEf project's Insert().


What is the syntax for it?

Thursday, July 03, 2014  |  From VS Templates

Not able to display error/warn/Info messages to user(UI) with asp.net webapplication?


How can i display Business rule required field error message to user ?


Any Example with webapplication will help me?

Tuesday, July 01, 2014  |  From VS Templates

I have created property status control for my Model property. When I removed the business rules of the corresponding properties from AddBusinessValidationRules(). It is not working.


 


Is it mandatory a business rule for showing propertystatus . Else some settings is available?


Please confirm

Monday, June 30, 2014  |  From VS Templates

I noticed that the ConnectionManager issues a lock on a static object in the GetManager() call, which on first run calls the constructor that in turns calls Open() on the new connection, a potentially "long" operation.


This seems to create a bottleneck on a busy web site, when GetManager gets called from many threads at the same time. In this scenario I don't see a need for locking, as all requests are running on their own thread (read; having their own private LocalContext - HttpContext.Items).


Any thoughts on this issue?


Regards;
/jb 

Monday, June 23, 2014  |  From VS Templates

I'm trying to have my WinRT app connect securely to a remote data portal over https, for obvious reasons. Up till now I've been testing internally without SSL, but when I start to test using a secured address I get the following error:


The provided URI scheme 'https' is invalid; expected 'http'. Parameter name: via Csla.DataPortalClient.WcfProxy.<Fetch>d__8.MoveNext():0


I'm assuming this is because my client isn't configured to use the same wcf bindings the server uses. This wouldn't be a problem for .NET because I'd add those settings in the config file, or in the clientconfig in a SL app. How do I set the WCF bindings correctly within a WinRT app?


I recall this recent thread with this response by Rocky: http://forums.lhotka.net/forums/p/11201/57463.aspx#57463. It somewhat speaks to issues with Universal apps not being able to do this, but I'm not using building a Universal app. Is configuring the WCF bindings in the app.xaml.cs a possibility? Hopefully I'm not forced into using the BrokeredProxy model. Thanks.

 VS Templates News Feed 

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

Comments

No comments yet.