Search Results

Search found 6 results on 1 pages for 'kmacmahon'.

Page 1/1 | 1 

  • Silverlight 4 Overriding the DataForm Autogenerate to insert Combo Boxes bound to Converters.

    - by kmacmahon
    I've been working towards a solution for some time and could use a little help. I know I've seen an example of this before, but tonight I cannot find anything close to what I need. I have a service that provides me all my DropDownLists, either from Cache or from the DomainService. They are presented as IEnumerable, and are requested from the a repository with GetLookup(LookupId). I have created a custom attribute that I have decorated my MetaDataClass that looks something like this: [Lookup(Lookup.Products)] public Guid ProductId I have created a custom Data Form that is set to AutoGenerateFields and I am intercepting the autogenerate fields. I am checking for my CustomAttribute and that works. Given this code in my CustomDataForm (standard comments removed for brevity), what is the next step to override the field generation and place a bound combobox in its place? public class CustomDataForm : DataForm { private Dictionary<string, DataField> fields = new Dictionary<string, DataField>(); public Dictionary<string, DataField> Fields { get { return this.fields; } } protected override void OnAutoGeneratingField(DataFormAutoGeneratingFieldEventArgs e) { PropertyInfo propertyInfo = this.CurrentItem.GetType().GetProperty(e.PropertyName); foreach (Attribute attribute in propertyInfo.GetCustomAttributes(true)) { LookupFieldAttribute lookupFieldAttribute = attribute as LookupFieldAttribute; if (lookupFieldAttribute != null) { // Create a combo box. // Bind it to my Lookup IEnumerable // Set the selected item to my Field's Value // Set the binding two way } } this.fields[e.PropertyName] = e.Field; base.OnAutoGeneratingField(e); } } Any cited working examples for SL4/VS2010 would be appreciated. Thanks

    Read the article

  • Need help understanding Generics, How To Abstract Types Question.

    - by kmacmahon
    I could use some really good links that explain Generics and how to use them. But I also have a very specific question, relater to working on a current project. Given this class constructor: public class SecuredDomainViewModel<TDomainContext, TEntity> : DomainViewModel<TDomainContext, TEntity> where TDomainContext : DomainContext, new() where TEntity : Entity, new() And its creation this way: DomainViewModel d; d = new SecuredDomainViewModel<MyContext, MyEntityType>(this.context, selectedProtectedItem); Assuming I have 20 EntityTypes within MyContext, is there any easier way to call the constructor without a large switch statement? Also, since d is DomainViewModel and I want to access methods for SecuredDomainViewModel, it seems I need to do this: if (((SecuredDomainViewModel<MyContext, MyEntityType>)d).IsBusy) But again "MyEntityType" could actually be one of 20 types. Is there anyway to write these types of statements where MyEntityType is returned from some sort of Reflection?

    Read the article

  • Need help understanding Generics, How To Abstract Types Question.

    - by kmacmahon
    I could use some really good links that explain Generics and how to use them. But I also have a very specific question, relater to working on a current project. Given this class constructor: public class SecuredDomainViewModel<TDomainContext, TEntity> : DomainViewModel<TDomainContext, TEntity> where TDomainContext : DomainContext, new() where TEntity : Entity, new() public SecuredDomainViewModel(TDomainContext domainContext, ProtectedItem protectedItem) : base(domainContext) { this.protectedItem = protectedItem; } And its creation this way: DomainViewModel d; d = new SecuredDomainViewModel<MyContext, MyEntityType>(this.context, selectedProtectedItem); Assuming I have 20 different EntityTypes within MyContext, is there any easier way to call the constructor without a large switch statement? Also, since d is DomainViewModel and I later need to access methods from SecuredDomainViewModel, it seems I need to do this: if (((SecuredDomainViewModel<MyContext, MyEntityType>)d).CanEditEntity) But again "MyEntityType" could actually be one of 20 diffent types. Is there anyway to write these types of statements where MyEntityType is returned from some sort of Reflection?

    Read the article

  • RIA Services Localization, where to place Resource Files

    - by kmacmahon
    I have the following Solution: SomeProject.Ria (non Silverlight code) SomeProject.Ria.Silverlight (Silverlight light code, namespace is still SomeProject.Ria) SomeProject.Ria.MyServices (RIA Services Domain Service) SomeProject.Ria.MyServices.Proxies (RIA Services Silverlight Generated Code) SomeProject.Shell (Silverlight Applicaiton) SomeProject.Web (Web Application) I would like to use Resource Files for my Annotations on the meta data class in SomeProject.Ria.MyServices. The format for that appears to be: [Required(AllowEmptyStrings=false,ErrorMessageResourceName="ThisFieldIsRequired", ErrorMessageResourceType(MyResource))] Which project does MyResource belong in? (Assuming that someday I need to support other culture files). Also the use of the string in here really seems to breed room for error, is it possible to do something like this and still achieve localization, or does this just get compiled into the meta data? If not, how can I get round the resource name being a string? [Required(AllowEmptyStrings=false,ErrorMessage=MyResources.RequiredMessage)]

    Read the article

  • Best Practice for Shell Layout and Switching Views - Prism, SL4, On Demand Load Modules

    - by kmacmahon
    I am learning Prism, and I have a question on the best approach for the main Shell. Assuming the Shell has 2 regions: Toolbar, Main. The toolbar has 3 main buttons that each represent a different On Demand Load Module. Each of these modules currently register themselves as fitting in the Main Region. When I click one of the buttons I want to do the following: Notify any active view that its switching, with an option to cancel if there is a pending action still required. This might cascade to child views. If the action isn't cancelled then load the on demand module if it has not yet been loaded, else activate it within the region. Should these three modules all fit in the same Region or should my shell have 3 regions defined within content presenters? One of the areas I got stuck on was that when you register a view from the Module Initialize, it doesn't get added with a strongly typed name, so when I tried to determine if my view was already added to the region with GetView(viewname) it always returns null, so I end up adding another view to the region.

    Read the article

  • COM+ Connection Pooling Doesn't Appear to be working on SQL Server 2005 Cluster

    - by kmacmahon
    We have a COM+ Data Layer that utilized Connection Pooling. Its deployed to 3 clusters, 2 SQL Server 2000 and 1 SQL Server 2005 environment. We noticed today that our monitoring software is reporting Thousands of Logins per minute on the SQL Server 2005 box. I did some tracing in both environments and profiler is reporting this for the 2000 boxes: sp_reset_connection SQL CALL sp_reset_connection SQL CALL sp_reset_connection SQL CALL and this for the 2005 box: Audit Logout sp_reset_connection Audit Login SQL CALL Audit Logout sp_reset_connection Audit Login SQL CALL Audit Logout sp_reset_connection Audit Login SQL CALL Is there some sort configuration for SQL Server 2005 different from SQL Server 2000 that we might be missing that would be creating this issue?

    Read the article

1