Quantcast
Channel: CSLA .NET
Viewing all 764 articles
Browse latest View live

DataPortal.ProxyModes is not defined

$
0
0

Hi guys,

I've decided to look at doing some Silverlight/Web development using CSLA for the first time having used it very successfully in the desktop environment for the last 10 years or so.

I figured the easiest way would be to look at one of the sample projects provided in the CSLA package.

Specifically, I try to load the SimpleApp Silverlight VB.net solution and it will not build because of the following error(s):

Type 'DataPortal.ProxyModes' is not defined. (CustomerEdit.vb)

Csla.DataPortalClient.LocalProxy' has no type parameters and so cannot have type arguments CustomerEdit.vb

'Csla.DataPortalClient.LocalProxy' has no type parameters and so cannot have type arguments.CustomerEdit.vb

 'Csla.DataPortalClient.LocalProxy' has no type parameters and so cannot have type arguments.

'ProxyModes' is not declared. It may be inaccessible due to its protection level. Page.xaml.vb

I've tried to load the project in Studio 2010 and 2013 - same issue (as I would expect)

Any ideas what I need to rectify this? My reference to CSLA looks fine...

 

 

Thanks in advance,

 

Graham

 

 

 

 

 

 


DataPortal.CreateAsync does not call DataPortal_Create through the data portal using CSLA 4.5.501

$
0
0

I am creating a Silverlight 5 application with the latest CSLA 4.5.501 (installed via Nuget). I am using the new async await syntax and have discovered that DataPortal.CreateAsync does not call the DataPortal_Create method on a simple BusinessBase object.

If I change the DataPortal.CreateAsync call to DataPortal_FetchAsync in the factory method then it successfully calls the DataPortal_Fetch method through the data portal.

Calling the CreateAsync with no parameters does not call the “protected override void DataPortal_Create()” method and calling CreateAsync with a single string parameter does not call the “protected void DataPortal_Create(string username)”.

If I flag the DataPortal_Create method as [RunLocal] and move it outside the #if !SILVERLIGHT #endif block then the CreateAsync call works.

Adding a try catch around the DataPortal.CreateAsync call does not catch any exceptions.

I know my WCF configuration is correct because the DataPortal_Fetch works.

Has anyone else observed this behaviour?

PropertyChanged Notifications with "using relationships"

$
0
0

I was hoping that someone could lend some ideas on how to properly setup a scenario I'm working with:

In my situation, I have a parent business object which uses another object as a property.  As a simple example, consider this parent is a "Person" and the property is "FavoriteColor".  In the user interface, the "FavoriteColor" property would be selected from a list of "Color" items, which are separately maintained & edited in a "Colors" collection.

Since the "Color" objects can be used by many "Person" objects, I understand the most appropriate way to set the "FavoriteColor" property on the "Person" is by storing the ID of the "Color" object and not a reference to the actual instance of the "Color" itself.  In other words, a "using relationship" model.

However, by only storing the ID of the object, it seems that the "Person" will not be aware of any changes which occur to the properties of the "Color" object.

My question is: When applying the "using relationship" model and only the ID of the referenced "Color" object is stored, what is the best way to make sure the "Person" is aware of changes made to the assigned "Color" item?

My best guess is that this will require I set up a listener on the "Color" item when the ID is assigned to the "FavoriteColor" property.

Thanks for your help!

 

reading and writing app configs to the database and defining if ther are editable or not?

$
0
0

Hi 

we have recently decided to transfer all our app configs to the database.

right now we consider all these configs to be both readable and writeable.

but we want to future proof it so that if a certain client decides to make a certain category of configs to be only readable we could manage it.

at the moment a single business object reads all the configs from the database and stores them. 

the following is a simple schema representing our table.

CREATE TABLE GlobalSettings
(
    SectionName VARCHAR(50),
    SettingName VARCHAR(50),
    SettingValue VARCHAR(1000),
    SettingType TINYINT
);

my question is that how should we design our class so that we can achieve this?

 

 

Business Rule Context Information

$
0
0

Hello

We have a class that contains property X with some expensive rules associated to it. We want all rules to fire if the value of property X gets changed, but we would like to suppress some of its rule if the rules are being fired due to an explicit call to ‘CheckRules(X)’ or due to property X having dependencies with other properties.


In other words, we need context to know why are the businesses rules being fired so we can determine whether to run them or not.


I took a quick look at the business rule runtime information and couldn’t find anything that could give me that context. Am I missing something or is it not possible to do what we want to do.


By the way, we already have a work around that solves our issue but I was wondering if I am missing something and there is a formal way of doing what we are doing the proper way.


We are currently using CSLA 4.2.2.0


Thanks.

AuthorizationActions.EditObject seems doesn't work on child object.

$
0
0

How to prevent user to edit child object?

I have class with f.ex "orders" property. This is "BusinessBindingListBase" which contains "Order" objects.

I thought I can add "authorization rule" (AuthorizationActions.EditObject) that implements some logic. But it never executes. I can edit this child object and even save it. It looks wierd. How to prevent child object editing?

IsDirty Change Event

$
0
0

Good day.

i would like to get some help on the following. i am working in a WinForms environment application, i have a "Save" button but i would like to enable/disable the button is my object has been changed. i would think that i would need to check the 'IsDirty' flag of my object, is this correct?

if so, how would i get a raised event when my 'IsDirty' property gets changed so that i can enable/disable my save button accordingly?

any help with on this would be much appreciated.

Lookupedit add and remove items ?

$
0
0

Can Lookupeditaddand removeeachitem ?


Unable to Run Test Multiple Time With Save Method

$
0
0

Csla 4.3.13 / Visual Studio 2010

I am unable to run test scripts multiple time which contains a call to the save method without rebuilding the solution. If the po.save is commented out in the code below can be run an infinite number of time. If the save is included I receive 'DataPortal.Fetch failed (Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.)' upon the call to  GetVendor.  The PO.Insert is run inside using statements 

        [TestMethod()]

        public void _MultiRunDiagnostics()

        {

            PO po = PO.NewPO();

            po.Vendor = ror.Vendor.GetVendor(1);

            po.Number = DateTime.Now.Ticks.ToString().Substring(0, 12);

            po.Date = DateTime.Now;

            Assert.IsTrue(po.IsSelfValid);

            Assert.IsFalse(po.IsSavable);

            Assert.IsTrue(po.IsStatus(PO.eStatus.New));

            Assert.AreEqual<string>(DateTime.Today.ToShortDateString(), po.StatusDate.ToShortDateString());

            PODetailListItem detail = po.DetailLines.AddNew();

            detail.ItemID = 4;

            detail.Quantity = 1;

            Assert.AreEqual<Decimal>(1.01m, detail.Cost);

            Assert.IsTrue(detail.IsSavable);

            Assert.IsTrue(po.IsSavable);

 

            // test can be run repeatedly if save is excluded

            po = po.Save();

        }

 

 

Set or get the background color NavBar Control of DevExpress ?

$
0
0

I've set (or get) the background color NavBar Control but it isn't ? you see code below.

set background color NavBar Control:

Code:
navBarControl1.Appearance.GroupBackground.BackColor = Color.White;
navBarControl1.BackColor = Color.White;



or get background color NavBar Control:

Code:
System.Drawing.Color c1 = navBarControl1.Appearance.GroupBackground.BackColor;
System.Drawing.Color c2 = navBarControl1.BackColor;
webBrowser1.Document.BackColor = c1;
webBrowser2.Document.BackColor = c2;


do you know set or get the background color NavBar ?

async await & ConnectionManager& [TestMethod]

$
0
0

I'm just starting a new project and using CSLA async await syntax for the first time, I'm experiencing an issue with the ConnectionManager<C> when running a MS Test, in that sometimes ConnectionManager<C>.GetManager() contains a disposed Connection.

 

I have identified that DeRef() disposes the Connection but does not always remove the ConnectionManager from LocalContext (LocalContext.Contains(contextName) == false on the thread that is calling it, so can not find it to remove it).

When GetManager() is called for a second time (LocalContext.Contains(contextName) == true, as it was not removed in DeRef(), and) returns the original ConnectionManager which has the disposed Connection.

 

I can solve the issue by replacing the use of ApplicationContext.LocalContext with a static Dictionary<string, ConnectionManager<C>>, but I suspect there is a good reason why LocalContext is being used?

 

Some abbreviated code for context...

[TestMethod]
 public async Task MyTest()
{
  var cust1 = await Customer.GetAsync(1);  
  var cust2 = await Customer.GetAsync(2);

...

private async Task DataPortal_Fetch(int id)
{
  using (var manager = ConnectionManager<SqlConnection>.GetManager(connStr, false))
  {
    ...
  } 

I'm using .ConfigureAwait(false) in all but the top level DataPortal_XYZ methods.

Any suggestions?

 

Regards

 

Peran

 

 

CSLA and the new ASP.NET Web API

$
0
0

I was going through some of the examples on the new web API that is part of the asp.net mvc 4 beta release.  Does CSLA fit with the Web API model?  I'm new to ASP.NET MVC and am trying to figure out if I should consider the web API for use with CSLA.  Thanks.

Questions about upgrade path

$
0
0

My team currently supports a WinForms application (~100k lines of code) built on top of CSLA 3.6.3. We are using mainly unmanaged properties (we got started before managed properties were introduced). The few classes we built using managed properties were done in 3.6.3. We are now looking at upgrading to the newest version and have some concerns.

I should mention that, while we are using DataPortal methods, everything runs locally and we are not considering an application server. We are also not considering any other client technology, like a web UI. 

As Rocky mentioned in this post on Stack Overflow, the amount of work looks daunting. In some of my recent experience with managed properties, it can save a little work and a few lines of code, but can introduce some complexity and a learning curve that seems like a distraction. A couple of examples:

  1. We like being able to hover over a backer field in the ide to see its value; harder to do with a managed property.
  2. We recently spent two days trying to understand why a child object was not garbage collected and turned up in another object; moving to an unmanaged property immediately solved the issue, though I'm still not sure why. Very frustrating.

 

Before we start down the path of upgrading, we want to be really sure it will be time well spent. We have two other options: stick with our current version (3.6.3) or ditch CSLA and rewrite some key functionality into our own base classes. If we do decide to upgrade, we are facing a huge task. We cannot upgrade in pieces, so we would likely spend several months fixing the code before we could ever get it to compile and by then we might conclude that we fundamentally misunderstood how to use managed properties. The same holds true for the way validation rules are now structured.

My questions: are there any good ways to do this gradually? Could we reference two versions of CSLA? Could we use unmanaged properties and the older validation rules methods in the newest version? What are the risks of other significant changes to the basic model of CSLA down the road?

 

Dynamic Root List - Editable Root's Editable Child List not saving via DataGridView

$
0
0

Hi,

I’m developing a Winforms app using .NET 4.5 and CSLA 4.5.

I’ve have a Dynamic Root List that has Editable Root objects with an Editable Child list.

I’ve have two DataGridViews bound to the same binding source with the second DataGridView’s data member set to the child list.

Selecting an Editable Root from Grid 1 displays the children as expected in Grid two.  Inserting child records or updating existing child records in Grid 2 only seem to persist when I select a different Editable Root from Grid 1.

If I refresh the Dynamic Root List before selecting a different Editable Root the amendments to the child records are lost.

If I add a new Editable Root and Editable Children refreshing the Dynamic Root List will persist the Editable Root but not the children, they just disappear.

Calling EndEdit on the grids before refreshing the Dynamic Root List doesn’t change the result.  Creating a separate binding source for Grid 2 and binding that to the first binding source made no difference either.

If I call SaveItem from the Dynamic Root List it will save the children, however I was hoping not to have to manually do that.

Do you have any suggestions as to why the Editable Child list is not saving when the Editable Root does?

Your help is greatly appreciated.

Kind regards

 

Nathan

Updated samples for csla 4.5?

$
0
0

Hi Gents,

Have the samples been updated for Silverlight projects, etc. since the release of 4.5.

With all of the breaking changes, trying to decipher what needs to be changed in the samples is proving troublesome - especially as I am now looking at Silverlight/Mobile development for the first time.

Thanks!

 

 


Binding Child Collection with BeginCollectionItem

$
0
0

Hey Guys,

I was wondering if anyone has gotten their child collection to automatically bind when using the BeginCollecitonItem. I am using the latest CSLA and MVC5 and I am having trouble. If I do the default:

 

[0].Name and such, it works just fine.

 

But if I use the BeginCollecitonItem

[randomIndex].Name

It doesn't pick it up when I try doing the UpdateModel in the controller. It works when I use a generic List<Model>, but when I use the BusinessListBase it doesn't pick it up. 

 

Again I would appreciate it if anyone has any idea on how I can get this to work. The random index is really nice since I can dynamically add new children on the page.

Assigning default values to properties

$
0
0

Hello..

I have created a Silverlight application with CSLA. I want to assign default values to some of the BusinessBase class's properties, which are not bound to the UserControls.

eg: 1] SysDate - The current datetime should be assigned to it.

2] UserId - The current user's id should be assigned to it.

These fields are not bound to UI.

So, where should I assign these values in BusinessBase class?

Or what is the best practice for handling such type of issue?

 

Authentication for WinRT LOB app

$
0
0

I've previously created a Windows Store app that used Azure Mobile Services for authentication, which made things easy. I'm now working on a native Win 8 app for my company, and our network/infrastructure folks aren't comfortable with me using Azure.

For authenticating the clients over the internet for access to back end services within our network, I'm reading through the Using CSLA DataPortal e-book. Specifically, I'm looking at the "Custom Authentication with a Smart Client" section, trying to determine if that is the right route to go.

Does this sound like the right path for native Win 8 clients out in the field to access data back on premises? (e.g. we'd have a DP endpoint in the DMZ that acts as a relay to another DP endpoint on a behind-the-firewall application server, which would then communicate with Active Directory to authenticate and create the principal object.) Thoughts?

inners exceptions from dataportal

$
0
0

We started using Csla, and our object graph is deeper than usual, I think about six levels. One complaint is that if an exception occurs in a lower level data portal method, by the time it gets back to the client code the real exception is in like six InnerExceptions, all DPE.  Is there any reason for this?  I understand wrapping in one DP exception, but it doesn't seem like having to recourse through all the inner exceptions adds any value.  Is it possible to have Csla only wrap the exception once?

TransactionScope enhancement request.

$
0
0

This probably has been discussed before but here is my go at it…

When using transaction scope, the CSLA creates an instance of the TransactionScope class using its default constructor which in turn uses a default timeout value. The problem with the default timeout value is that is an arbitrary value which sometimes is good enough and sometimes is not.

This creates nondeterministic application behavior since an identical operation may sometimes succeed and sometimes fail depending on unpredictable factors such as server load or network traffic. For example, if the server load is low the operation will succeed but if the server load is high the exact same operation will fail because TransactionScope times out. Unfortunately, there is nothing we can do about this because the CSLA does not allow the timeout to be adjusted.

In order to make the transaction scope feature truly useful the CSLA should either default the timeout to the max value possible and let connection or command itself time out (have not tried this but my guess is that those two should be able to handle timeouts) or add functionality to the TransactionalAttribute so that we can specify our own timeout.

Is this a sensible request or am I approaching this all wrong?

Thanks.

Viewing all 764 articles
Browse latest View live