@Aaron,
Thanks a lot, I will try this and let you know if I face any challenge.
Suppose you have a table named as TestTbl, which has Id, TestId (varchar), TestId2 and some other columns. I need to have Id as autoincrement identity. TestId as PK. TestId2 unique constraint.
Requirement is very clear. What do you mean by concrete example?
This link doesn’t answer my question.
My requirement is very simple, which I have already mentioned in question.
I tried the link solution when I failed to create other columns as PK. Then I tried to create unique constraints on columns.
@vladsd
You can refer this [https://code.visualstudio.com/docs/languages/typescript])
Any Updates please ?
Hi,
Thanks for your reply.
I'm getting the build errors with the code you shared, I have sent you mail regarding the same, please check.
Hi @ismcagdas,
Thanks for your help.
I tried the exact step mentioned by you, But still, I'm getting the >Duplicate function implementation error. Do I need to make any other changes also?
Below is the generated service-proxies.ts file.
export class AppServiceProxy {
{
private http: Http;
private baseUrl: string;
protected jsonParseReviver: (key: string, value: any) => any = undefined;
constructor(@Inject(Http) http: Http, @Optional() @Inject(API_BASE_URL) baseUrl?: string) {
this.http = http;
this.baseUrl = baseUrl ? baseUrl : "";
}
/**
* @return Success
*/
test(id: number): Observable<void> {
let url_ = this.baseUrl + "/api/services/app/Test?";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined and cannot be null.");
else
url_ += "Id=" + encodeURIComponent("" + id) + "&";
url_ = url_.replace(/[?&]$/, "");
const content_ = "";
let options_ = {
body: content_,
method: "get",
headers: new Headers({
"Content-Type": "application/json; charset=UTF-8",
"Accept": "application/json; charset=UTF-8"
})
};
return this.http.request(url_, options_).flatMap((response_) => {
return this.processTest(response_);
}).catch((response_: any) => {
if (response_ instanceof Response) {
try {
return this.processTest(response_);
} catch (e) {
return <Observable<void>><any>Observable.throw(e);
}
} else
return <Observable<void>><any>Observable.throw(response_);
});
}
protected processTest(response: Response): Observable<void> {
const status = response.status;
if (status === 200) {
const responseText = response.text();
return Observable.of<void>(<any>null);
} else if (status === 401) {
const responseText = response.text();
return throwException("A server error occurred.", status, responseText);
} else if (status !== 200 && status !== 204) {
const responseText = response.text();
return throwException("An unexpected server error occurred.", status, responseText);
}
return Observable.of<void>(<any>null);
}
/**
* @return Success
*/
test(input: NoticeDetailsDto): Observable<void> {
let url_ = this.baseUrl + "/api/services/app/Test";
url_ = url_.replace(/[?&]$/, "");
const content_ = JSON.stringify(input ? input.toJSON() : null);
let options_ = {
body: content_,
method: "put",
headers: new Headers({
"Content-Type": "application/json; charset=UTF-8",
"Accept": "application/json; charset=UTF-8"
})
};
return this.http.request(url_, options_).flatMap((response_) => {
return this.processTest(response_);
}).catch((response_: any) => {
if (response_ instanceof Response) {
try {
return this.processTest(response_);
} catch (e) {
return <Observable<void>><any>Observable.throw(e);
}
} else
return <Observable<void>><any>Observable.throw(response_);
});
}
protected processTest(response: Response): Observable<void> {
const status = response.status;
if (status === 200) {
const responseText = response.text();
return Observable.of<void>(<any>null);
} else if (status === 401) {
const responseText = response.text();
return throwException("A server error occurred.", status, responseText);
} else if (status !== 200 && status !== 204) {
const responseText = response.text();
return throwException("An unexpected server error occurred.", status, responseText);
}
return Observable.of<void>(<any>null);
}
/**
* @return Success
*/
test(input: NoticeDetailsDto): Observable<void> {
let url_ = this.baseUrl + "/api/services/app/Test";
url_ = url_.replace(/[?&]$/, "");
const content_ = JSON.stringify(input ? input.toJSON() : null);
let options_ = {
body: content_,
method: "post",
headers: new Headers({
"Content-Type": "application/json; charset=UTF-8",
"Accept": "application/json; charset=UTF-8"
})
};
return this.http.request(url_, options_).flatMap((response_) => {
return this.processTest(response_);
}).catch((response_: any) => {
if (response_ instanceof Response) {
try {
return this.processTest(response_);
} catch (e) {
return <Observable<void>><any>Observable.throw(e);
}
} else
return <Observable<void>><any>Observable.throw(response_);
});
}
protected processTest(response: Response): Observable<void> {
const status = response.status;
if (status === 200) {
const responseText = response.text();
return Observable.of<void>(<any>null);
} else if (status === 401) {
const responseText = response.text();
return throwException("A server error occurred.", status, responseText);
} else if (status !== 200 && status !== 204) {
const responseText = response.text();
return throwException("An unexpected server error occurred.", status, responseText);
}
return Observable.of<void>(<any>null);
}
/**
* @return Success
*/
test(id: number): Observable<void> {
let url_ = this.baseUrl + "/api/services/app/Test?";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined and cannot be null.");
else
url_ += "Id=" + encodeURIComponent("" + id) + "&";
url_ = url_.replace(/[?&]$/, "");
const content_ = "";
let options_ = {
body: content_,
method: "delete",
headers: new Headers({
"Content-Type": "application/json; charset=UTF-8",
"Accept": "application/json; charset=UTF-8"
})
};
return this.http.request(url_, options_).flatMap((response_) => {
return this.processTest(response_);
}).catch((response_: any) => {
if (response_ instanceof Response) {
try {
return this.processTest(response_);
} catch (e) {
return <Observable<void>><any>Observable.throw(e);
}
} else
return <Observable<void>><any>Observable.throw(response_);
});
}
protected processTest(response: Response): Observable<void> {
const status = response.status;
if (status === 200) {
const responseText = response.text();
return Observable.of<void>(<any>null);
} else if (status === 401) {
const responseText = response.text();
return throwException("A server error occurred.", status, responseText);
} else if (status !== 200 && status !== 204) {
const responseText = response.text();
return throwException("An unexpected server error occurred.", status, responseText);
}
return Observable.of<void>(<any>null);
}
}
Any updates please?
Any updates please?