Angular 2: 如何 import/export 一个 c# 生成的模型

Angular 2: How to import/export a c# generated model

Q) 如何在下面的服务中使用下面的接口模块?

如果我从 c# 生成以下模型:

declare module App.Core.Model {
    interface Address extends App.Core.Model.BaseEntity {
        addressLine1: string;
        addressLine2: string;
        addressLine3: string;
        area: string;
        countryCode: string;
        name: string;
        postcode: string;
        town: string;
    }
}

服务:

    // these don't work, get "model.ts error is not a module" 
    import {Client} from '../interfaces/model';
    import {AdminUser} from '../interfaces/model';
    import {Building} from '../interfaces/model';


    @Injectable()
    export class AppService {
        ...
    }

文件位于:

您可以执行以下操作(圆点已替换为下划线):

declare module App_Core_Model {
    export interface Address extends App.Core.Model.BaseEntity {
        addressLine1: string;
        addressLine2: string;
        addressLine3: string;
        area: string;
        countryCode: string;
        name: string;
        postcode: string;
        town: string;
    }
}
 declare module "app_core_model" {
    export = App_Core_Model;
}

那么在导入"app_core_model"模块时应该可以使用接口,例如:

import {Address} from 'app_core_model';

此外,模块名称似乎不能包含点,因为它会破坏导入