powered by simpleCommunicator - 2.0.51     © 2025 Programmizd 02
Форумы / WPF, Silverlight [игнор отключен] [закрыт для гостей] / Добавление полей в Metadata?
2 сообщений из 2, страница 1 из 1
Добавление полей в Metadata?
    #37756712
Miad
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Есть класс метаданных автосгенрированный.
Нужно в него добавить поле которое не будет связано с полями базы данных.
Пишут, что для этого надо поставить атрибут [DataMember]
Код: c#
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
   // The MetadataTypeAttribute identifies usersMetadata as the class
    // that carries additional metadata for the users class.
    [MetadataTypeAttribute(typeof(users.usersMetadata))]
    public partial class users
    {
      ...
 // This class allows you to attach custom attributes to properties
        // of the users class.
        //
        // For example, the following marks the Xyz property as a
        // required property and specifies the format for valid values:
        //    [Required]
        //    [RegularExpression("[A-Z][A-Za-z0-9]*")]
        //    [StringLength(32)]
        //    public string Xyz { get; set; }
        internal sealed class usersMetadata
        {

            // Metadata classes are not meant to be instantiated.
            private usersMetadata()
            {
            }
            [Display(Name = "Пароль", Order = 3)]
            public string password { get; set; }

            [DataMember]
            [Display(Order = 4, Name = "NewPassword")]
            public string NewPassword { get; set; }

       }



Но не помогает, ругается.

Error 7 'App.Web.DataAccess.users' does not contain a definition for 'NewPassword' and no extension method 'NewPassword' accepting a first argument of type 'PFDC.Web.DataAccess.pfdc_users' could be found (are you missing a using directive or an assembly reference?) D:\Projects\MyApp\App.Web\DomainModel\UserDomainService.cs 314 82 App.Web

В чем может быть проблема?
...
Рейтинг: 0 / 0
Добавление полей в Metadata?
    #37757095
Miad
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Ответ оказался очень прост...
Код: c#
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
 // The MetadataTypeAttribute identifies usersMetadata as the class
    // that carries additional metadata for the users class.
    [MetadataTypeAttribute(typeof(users.usersMetadata))]
    public partial class users
    {
      ...
       // This class allows you to attach custom attributes to properties
        // of the users class.
        //
        // For example, the following marks the Xyz property as a
        // required property and specifies the format for valid values:
        //    [Required]
        //    [RegularExpression("[A-Z][A-Za-z0-9]*")]
        //    [StringLength(32)]
        //    public string Xyz { get; set; }
        internal sealed class usersMetadata
        {
               ...
            // Metadata classes are not meant to be instantiated.
            private usersMetadata()
            {
            }
            [Display(Name = "Пароль", Order = 3)]
            public string password { get; set; }
             ...
       }
          [DataMember]
          public string NewPassword { get; set; }
}


Нужно не в usersMetadata добавлять а в users
...
Рейтинг: 0 / 0
2 сообщений из 2, страница 1 из 1
Форумы / WPF, Silverlight [игнор отключен] [закрыт для гостей] / Добавление полей в Metadata?
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]